Interface Collection<T>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void clear()
      Removes all elements from the collection.
      java.util.Comparator<T> getComparator()
      Returns the collection's sort order.
      boolean isEmpty()
      Tests the emptiness of the collection.
      void setComparator​(java.util.Comparator<T> comparator)
      Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order.
      • Methods inherited from interface java.lang.Iterable

        forEach, iterator, spliterator
    • Method Detail

      • clear

        void clear()
        Removes all elements from the collection.
      • isEmpty

        boolean isEmpty()
        Tests the emptiness of the collection.
        Returns:
        true if the collection contains no elements; false, otherwise.
      • getComparator

        java.util.Comparator<T> getComparator()
        Returns the collection's sort order.
        Returns:
        The comparator used to order elements in the collection, or null if the sort order is undefined.
        See Also:
        setComparator(Comparator)
      • setComparator

        void setComparator​(java.util.Comparator<T> comparator)
        Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order.

        Calling this method more than once with the same comparator will re-sort the collection.

        Parameters:
        comparator - The comparator used to order elements in the collection, or null if the collection is unsorted.