EKK
EKK

Reputation: 171

How to sort a guava table by row natural order and column insertion order

I have started using guava table package in Java - I am trying to create a table where the rows are sorted by natural order and the columns by the insertion order (so it is a "mix" of TreeMap for the rows and "linkedhashmap" for the columns).

HashBasedTable does not seem to sort anything TreeTable sorts on both rows and columns -

So here I am looking for the hybrid version.

Upvotes: 5

Views: 1423

Answers (1)

Frank Pavageau
Frank Pavageau

Reputation: 11705

You can create your own Table implementation by using Tables.newCustomTable() and specifying both the row-holding Map and a factory for the row Maps.

Upvotes: 5

Related Questions