Package org.apache.sis.util.collection
Class FrequencySortedSet.SubSet
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
org.apache.sis.util.collection.FrequencySortedSet.SubSet
- All Implemented Interfaces:
Serializable,Iterable<E>,Collection<E>,Set<E>,SortedSet<E>
- Enclosing class:
- FrequencySortedSet<E>
private final class FrequencySortedSet.SubSet
extends AbstractSet<E>
implements SortedSet<E>, Serializable
A view over a subset of
FrequencySortedSet.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate E[]Reference to theFrequencySortedSet.sortedarray, used for detecting changes.private final ELow endpoint (inclusive) of the subset.private final booleanWhether the set should take in accountfromElementortoElement.private final booleanWhether the set should take in accountfromElementortoElement.private intLower and upper index computed fromfromElementandtoElement.private static final longFor cross-version compatibility.private final EHigh endpoint (exclusive) of the subset.private intLower and upper index computed fromfromElementandtoElement. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the comparator, which is the same thanFrequencySortedSet.comparator().private voidfirst()Returns the first element in this subset.Returns a view of the portion of this subset whose elements occur with a frequency strictly less thantoElementfrequency.iterator()Returns an iterator over the elements in this subset.last()Returns the last element in this subset.intsize()Returns the number of elements in this subset.Returns a view of the portion of this subset whose elements occur with a frequency in the range offromElementfrequency inclusive totoElementfrequency exclusive.Returns a view of the portion of this subset whose elements occur with a frequency equal or greater thanfromElementfrequency.Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAllMethods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, streamMethods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArrayMethods inherited from interface java.util.SortedSet
spliterator
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
elements
Reference to theFrequencySortedSet.sortedarray, used for detecting changes. -
fromElement
Low endpoint (inclusive) of the subset. May benull. -
toElement
High endpoint (exclusive) of the subset. May benull. -
hasFrom
private final boolean hasFromWhether the set should take in accountfromElementortoElement. We have to use those booleans (we cannot usenullsentinel value instead) becausenullis a legal value forfrom/toElement. -
hasTo
private final boolean hasToWhether the set should take in accountfromElementortoElement. We have to use those booleans (we cannot usenullsentinel value instead) becausenullis a legal value forfrom/toElement. -
lower
private transient int lowerLower and upper index computed fromfromElementandtoElement. -
upper
private transient int upperLower and upper index computed fromfromElementandtoElement.
-
-
Constructor Details
-
SubSet
Creates a new subset from the lower element (inclusive) to the upper element (exclusive). Each endpoint can be null.
-
-
Method Details
-
comparator
Returns the comparator, which is the same thanFrequencySortedSet.comparator().- Specified by:
comparatorin interfaceSortedSet<E>
-
ensureValidRange
private void ensureValidRange() -
iterator
Returns an iterator over the elements in this subset. -
size
public int size()Returns the number of elements in this subset.- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceSet<E>- Specified by:
sizein classAbstractCollection<E>
-
first
Returns the first element in this subset. -
last
Returns the last element in this subset. -
headSet
Returns a view of the portion of this subset whose elements occur with a frequency strictly less thantoElementfrequency. -
tailSet
Returns a view of the portion of this subset whose elements occur with a frequency equal or greater thanfromElementfrequency. -
subSet
Returns a view of the portion of this subset whose elements occur with a frequency in the range offromElementfrequency inclusive totoElementfrequency exclusive. -
subSet
Implementation ofheadSet(Object),tailSet(Object)andsubSet(Object, Object). Theboundsargument tell whichFrequencySortedSetmethod to delegate to.
-