Class LimitedInMemorySortedIterable<E>

  • Type Parameters:
    E - the type of object to store in the LimitedInMemorySortedIterable.
    All Implemented Interfaces:
    Iterable<E>

    public class LimitedInMemorySortedIterable<E>
    extends Object
    implements Iterable<E>

    An Iterable which can sort, limit and deduplicate its elements. Sorting is achieved with a provided Comparator.

    This iterable is backed by a TreeMap, with items being dropped from the end of the backing TreeMap. To allow duplicates and to be stored the TreeMap is a map of item to collection of items. The tree map uses the comparator for equality checking, so the collection of items will contain items with a comparator score of 0, but potentially not equal using the equals method.

    • Constructor Detail

      • LimitedInMemorySortedIterable

        public LimitedInMemorySortedIterable​(Comparator<E> comparator)
      • LimitedInMemorySortedIterable

        public LimitedInMemorySortedIterable​(Comparator<E> comparator,
                                             Integer limit)
      • LimitedInMemorySortedIterable

        public LimitedInMemorySortedIterable​(Comparator<E> comparator,
                                             Integer limit,
                                             boolean deduplicate)