Class CircularList<T>

java.lang.Object
org.apache.druid.collections.CircularList<T>
All Implemented Interfaces:
Iterable<T>

@NotThreadSafe public class CircularList<T> extends Object implements Iterable<T>
A circular list that is backed by an ordered list of elements containing no duplicates. The list is ordered by the supplied comparator. The iterator keeps track of the current position, so iterating the list multiple times will resume from the last location and continue until a caller explicitly terminates it.

This class is not thread-safe and must be used from a single thread.

  • Constructor Details

    • CircularList

      public CircularList(Set<T> elements, Comparator<? super T> comparator)
  • Method Details

    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>
    • equalsSet

      public boolean equalsSet(Set<T> inputSet)
      Returns:
      true if the supplied set is equal to the set used to instantiate this circular list, otherwise false.