Class PreSortedSet

  • All Implemented Interfaces:
    java.io.Serializable, Cloneable, Iterable<String>, Collection<String>, Set<String>, SortedSet<String>

    public class PreSortedSet
    extends LinkedHashSet<String>
    implements SortedSet<String>
    This set is basically a LinkedHashSet that implements the SortedSet interface. We fundamentally want a set that is Sorted but the sort order is defined by the order of insertion (i.e. the order is managed externally). None of the core SortedSet functionality is implemented, however, you can run through the elements in the correct order :-).
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Comparator<? super String> comparator()  
      String first()  
      SortedSet<String> headSet​(String toElement)  
      String last()  
      SortedSet<String> subSet​(String fromElement, String toElement)  
      SortedSet<String> tailSet​(String fromElement)  
      • Methods inherited from class java.util.LinkedHashSet

        spliterator
      • Methods inherited from class java.util.HashSet

        add, clear, clone, contains, isEmpty, iterator, remove, size
      • Methods inherited from class java.util.AbstractSet

        equals, hashCode, removeAll
      • Methods inherited from class java.util.AbstractCollection

        addAll, containsAll, retainAll, toArray, toArray, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.Set

        add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
      • Methods inherited from interface java.util.SortedSet

        spliterator
    • Method Detail

      • first

        public String first()
        Specified by:
        first in interface SortedSet<String>
      • last

        public String last()
        Specified by:
        last in interface SortedSet<String>
      • comparator

        public Comparator<? super String> comparator()
        Specified by:
        comparator in interface SortedSet<String>
      • subSet

        public SortedSet<String> subSet​(String fromElement,
                                        String toElement)
        Specified by:
        subSet in interface SortedSet<String>
      • headSet

        public SortedSet<String> headSet​(String toElement)
        Specified by:
        headSet in interface SortedSet<String>
      • tailSet

        public SortedSet<String> tailSet​(String fromElement)
        Specified by:
        tailSet in interface SortedSet<String>