eclipse-collections
eclipse-collections copied to clipboard
ImmutableSortedBagImpl.distinctView() should return a more efficient implementation
As discussed in #1210, ImmutableSortedBagImpl.distinctView() was implemented by returning a simple ArrayAdapter over the internal array of the bag.
This means we don't take advantage of the comparator that guarantees the order of the elements of the array.
Taking advantage of it would improve performances for methods like contains().
Alternative solution for this would be:
- rely on
ImmutableTreeSetas it has the same internal guarantees as what we want, but the issue is that it would need to expose publicly a way to instantiate it with an array - introduce another implementation (maybe to be shared with
ImmutableTreeSet?)