Package spoon.support.util
Class QualifiedNameBasedSortedSet<E extends CtElement>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
java.util.TreeSet<E>
spoon.support.util.QualifiedNameBasedSortedSet<E>
- Type Parameters:
E
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<E>
,Collection<E>
,NavigableSet<E>
,Set<E>
,SortedSet<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 Summary
-
Method Summary
Methods inherited from class java.util.TreeSet
add, addAll, ceiling, clear, clone, comparator, contains, descendingIterator, descendingSet, first, floor, headSet, headSet, higher, isEmpty, last, lower, pollFirst, pollLast, remove, size, spliterator, subSet, subSet, tailSet, tailSet
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
Methods inherited from class java.util.AbstractCollection
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, toArray
-
Constructor Details
-
QualifiedNameBasedSortedSet
-
QualifiedNameBasedSortedSet
public QualifiedNameBasedSortedSet()
-
-
Method Details
-
iterator
The order of elements in this iterator is described instream()
.- Specified by:
iterator
in interfaceCollection<E extends CtElement>
- Specified by:
iterator
in interfaceIterable<E extends CtElement>
- Specified by:
iterator
in interfaceNavigableSet<E extends CtElement>
- Specified by:
iterator
in interfaceSet<E extends CtElement>
- Overrides:
iterator
in classTreeSet<E extends CtElement>
- Returns:
- A sorted iterator with all elements in this set.
-
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.- Returns:
- A sorted stream of all elements in this set.
-