tikinghu / google-collections

Automatically exported from code.google.com/p/google-collections
0 stars 0 forks source link

Implement TreeBiMap #283

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Is it possible to implement BiMap which guaranties O(log n) in put and get 
methods? Moreover it could provide iteration over elements in natural 
ordering of keys or values.

Original issue reported on code.google.com by kkazmier...@gmail.com on 30 Oct 2009 at 2:55

GoogleCodeExporter commented 9 years ago

Original comment by kevin...@gmail.com on 30 Oct 2009 at 4:00

GoogleCodeExporter commented 9 years ago
As a workaround, you could create a TreeMap and pass it to 
ImmutableBiMap.copyOf(),
which maintains the iteration order. All views of the resulting BiMap would be
ordered according to the natural ordering of the keys.

Original comment by jared.l....@gmail.com on 30 Oct 2009 at 4:47

GoogleCodeExporter commented 9 years ago
caveat: that's as long as the ordering is consistent with equals(), as 
ImmutableBiMap 
will collapse equal() elements.

Original comment by kevin...@gmail.com on 30 Oct 2009 at 4:51