Class QualifiedNameBasedSortedSet<E extends CtElement>

Type Parameters:
E -
All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, NavigableSet<E>, Set<E>, SortedSet<E>

public class QualifiedNameBasedSortedSet<E extends CtElement> extends TreeSet<E>
The set properties of this set are based on the qualified name of the element inserted. Using this set for elements without a qualified name does not work well. See the QualifiedNameComparator for details. The order of the iterator and stream of this set is based on two properties: qualified name and position. See stream() for details.
See Also:
Serialized Form
  • Constructor Details

    • QualifiedNameBasedSortedSet

      public QualifiedNameBasedSortedSet(Collection<E> elements)
    • QualifiedNameBasedSortedSet

      public QualifiedNameBasedSortedSet()
  • Method Details

    • iterator

      public Iterator<E> iterator()
      The order of elements in this iterator is described in stream().
      Specified by:
      iterator in interface Collection<E extends CtElement>
      Specified by:
      iterator in interface Iterable<E extends CtElement>
      Specified by:
      iterator in interface NavigableSet<E extends CtElement>
      Specified by:
      iterator in interface Set<E extends CtElement>
      iterator in class TreeSet<E extends CtElement>
      A sorted iterator with all elements in this set.
    • stream

      public Stream<E> stream()
      The elements of this stream is ordered into two partitions: elements without source position and elements with source position. Elements without source position appear first, and are between themselves ordered by their qualified names. Elements with source position appear last, and are between themselves ordered by their source position. The rationale for this ordering is that elements such as types listed in implements clauses, or types listed in thrown clauses, should not be reordered by qualified name as a result of parsing and printing with Spoon.
      A sorted stream of all elements in this set.