javacollectionssortedsettrove4j

Highest and lowest elements in trove TIntSet?


TIntSet is "sorted set" by sense, i.e. it's elements have natural order.

Unfortunately, I can't find any methods similar to first() and last().

Is it possible to overcome this lack somehow?


Solution

  • fastutil is all ways better than Trove. There is IntSortedSet interface with firstInt() and lastInt() methods.