Class GridBoundedConcurrentOrderedSet<E>

  • All Implemented Interfaces:
    Serializable, Cloneable, Iterable<E>, Collection<E>, NavigableSet<E>, Set<E>, SortedSet<E>

    public class GridBoundedConcurrentOrderedSet<E>
    extends GridConcurrentSkipListSet<E>
    Concurrent ordered set that automatically manages its maximum size. Once it exceeds its maximum, it will start removing smallest elements until the maximum is reached again.

    Note that due to concurrent nature of this set, it may grow slightly larger than its maximum allowed size, but in this case it will quickly readjust back to allowed size.

    Note that remove(Object) method is not supported for this kind of set.

    See Also:
    Serialized Form
    • Constructor Detail

      • GridBoundedConcurrentOrderedSet

        public GridBoundedConcurrentOrderedSet​(int max)
        Constructs a new, empty set that orders its elements according to their natural ordering.
        Parameters:
        max - Upper bound of this set.
      • GridBoundedConcurrentOrderedSet

        public GridBoundedConcurrentOrderedSet​(int max,
                                               Comparator<? super E> comp)
        Constructs a new, empty set that orders its elements according to the specified comparator.
        Parameters:
        max - Upper bound of this set.
        comp - the comparator that will be used to order this set. If null, the natural ordering of the elements will be used.
      • GridBoundedConcurrentOrderedSet

        public GridBoundedConcurrentOrderedSet​(int max,
                                               Collection<? extends E> c)
        Constructs a new set containing the elements in the specified collection, that orders its elements according to their natural ordering.
        Parameters:
        max - Upper bound of this set.
        c - The elements that will comprise the new set
        Throws:
        ClassCastException - if the elements in c are not Comparable, or are not mutually comparable
        NullPointerException - if the specified collection or any of its elements are null.
      • GridBoundedConcurrentOrderedSet

        public GridBoundedConcurrentOrderedSet​(int max,
                                               SortedSet<E> s)
        Constructs a new set containing the same elements and using the same ordering as the specified sorted set.
        Parameters:
        max - Upper bound of this set.
        s - sorted set whose elements will comprise the new set
        Throws:
        NullPointerException - if the specified sorted set or any of its elements are null.