Package com.google.common.collect
Class RegularImmutableSortedSet<E>
java.lang.Object
java.util.AbstractCollection<E>
com.google.common.collect.ImmutableCollection<E>
com.google.common.collect.ImmutableSet<E>
com.google.common.collect.ImmutableSet.CachingAsList<E>
com.google.common.collect.ImmutableSortedSetFauxverideShim<E>
com.google.common.collect.ImmutableSortedSet<E>
com.google.common.collect.RegularImmutableSortedSet<E>
- All Implemented Interfaces:
SortedIterable<E>,Serializable,Iterable<E>,Collection<E>,NavigableSet<E>,Set<E>,SortedSet<E>
An immutable sorted set with one or more elements. TODO(jlevy): Consider separate class for a
single-element sorted set.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.common.collect.ImmutableSortedSet
ImmutableSortedSet.Builder<E>Nested classes/interfaces inherited from class com.google.common.collect.ImmutableSet
ImmutableSet.CachingAsList<E>, ImmutableSet.Indexed<E> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ImmutableList<E>(package private) static final RegularImmutableSortedSet<Comparable>Fields inherited from class com.google.common.collect.ImmutableSortedSet
comparator, descendingSet, SPLITERATOR_CHARACTERISTICSFields inherited from class com.google.common.collect.ImmutableSet
MAX_TABLE_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionRegularImmutableSortedSet(ImmutableList<E> elements, Comparator<? super E> comparator) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleancontainsAll(Collection<?> targets) (package private) intcopyIntoArray(Object[] dst, int offset) Copies the contents of this immutable collection into the specified array at the specified offset.(package private) ImmutableList<E>(package private) ImmutableSortedSet<E>booleanfirst()void(package private) RegularImmutableSortedSet<E>getSubSet(int newFromIndex, int newToIndex) (package private) int(package private) ImmutableSortedSet<E>headSetImpl(E toElement, boolean inclusive) (package private) intReturns the position of an element within the set, or -1 if not present.(package private) Object[]If this collection is backed by an array of its elements in insertion order, returns it.(package private) intIf this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements end.(package private) intIf this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements start.(package private) booleanReturnstrueif this immutable collection's implementation contains references to user-created objects that aren't accessible via this collection's methods.iterator()Returns an unmodifiable iterator across the elements in this collection.last()intsize()(package private) ImmutableSortedSet<E>subSetImpl(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) (package private) int(package private) ImmutableSortedSet<E>tailSetImpl(E fromElement, boolean inclusive) private intunsafeBinarySearch(Object key) (package private) Comparator<Object>Methods inherited from class com.google.common.collect.ImmutableSortedSet
comparator, construct, copyOf, copyOf, copyOf, copyOf, copyOf, copyOf, copyOf, copyOfSorted, descendingSet, emptySet, headSet, headSet, naturalOrder, of, of, of, of, of, of, of, orderedBy, pollFirst, pollLast, reverseOrder, subSet, subSet, tailSet, tailSet, toImmutableSortedSet, unsafeCompare, unsafeCompare, writeReplaceMethods inherited from class com.google.common.collect.ImmutableSortedSetFauxverideShim
builder, builderWithExpectedSize, copyOf, of, of, of, of, of, of, toImmutableSetMethods inherited from class com.google.common.collect.ImmutableSet.CachingAsList
asListMethods inherited from class com.google.common.collect.ImmutableSet
chooseTableSize, hashCode, isHashCodeFastMethods inherited from class com.google.common.collect.ImmutableCollection
add, addAll, clear, remove, removeAll, removeIf, retainAll, toArray, toArrayMethods inherited from class java.util.AbstractCollection
isEmpty, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Field Details
-
NATURAL_EMPTY_SET
-
elements
-
-
Constructor Details
-
RegularImmutableSortedSet
RegularImmutableSortedSet(ImmutableList<E> elements, Comparator<? super E> comparator)
-
-
Method Details
-
internalArray
Description copied from class:ImmutableCollectionIf this collection is backed by an array of its elements in insertion order, returns it.- Overrides:
internalArrayin classImmutableCollection<E>
-
internalArrayStart
int internalArrayStart()Description copied from class:ImmutableCollectionIf this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements start.- Overrides:
internalArrayStartin classImmutableCollection<E>
-
internalArrayEnd
int internalArrayEnd()Description copied from class:ImmutableCollectionIf this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements end.- Overrides:
internalArrayEndin classImmutableCollection<E>
-
iterator
Description copied from class:ImmutableCollectionReturns an unmodifiable iterator across the elements in this collection.- Specified by:
iteratorin interfaceCollection<E>- Specified by:
iteratorin interfaceIterable<E>- Specified by:
iteratorin interfaceNavigableSet<E>- Specified by:
iteratorin interfaceSet<E>- Specified by:
iteratorin interfaceSortedIterable<E>- Specified by:
iteratorin classImmutableSortedSet<E>
-
descendingIterator
- Specified by:
descendingIteratorin interfaceNavigableSet<E>- Specified by:
descendingIteratorin classImmutableSortedSet<E>
-
spliterator
- Specified by:
spliteratorin interfaceCollection<E>- Specified by:
spliteratorin interfaceIterable<E>- Specified by:
spliteratorin interfaceSet<E>- Specified by:
spliteratorin interfaceSortedSet<E>- Overrides:
spliteratorin classImmutableSortedSet<E>
-
forEach
-
size
public int size()- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceSet<E>- Specified by:
sizein classAbstractCollection<E>
-
contains
- Specified by:
containsin interfaceCollection<E>- Specified by:
containsin interfaceSet<E>- Specified by:
containsin classImmutableCollection<E>
-
containsAll
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceSet<E>- Overrides:
containsAllin classAbstractCollection<E>
-
unsafeBinarySearch
- Throws:
ClassCastException
-
isPartialView
boolean isPartialView()Description copied from class:ImmutableCollectionReturnstrueif this immutable collection's implementation contains references to user-created objects that aren't accessible via this collection's methods. This is generally used to determine whethercopyOfimplementations should make an explicit copy to avoid memory leaks.- Specified by:
isPartialViewin classImmutableCollection<E>
-
copyIntoArray
Description copied from class:ImmutableCollectionCopies the contents of this immutable collection into the specified array at the specified offset. Returnsoffset + size().- Overrides:
copyIntoArrayin classImmutableCollection<E>
-
equals
- Specified by:
equalsin interfaceCollection<E>- Specified by:
equalsin interfaceSet<E>- Overrides:
equalsin classImmutableSet<E>
-
first
-
last
-
lower
- Specified by:
lowerin interfaceNavigableSet<E>- Overrides:
lowerin classImmutableSortedSet<E>
-
floor
- Specified by:
floorin interfaceNavigableSet<E>- Overrides:
floorin classImmutableSortedSet<E>
-
ceiling
- Specified by:
ceilingin interfaceNavigableSet<E>- Overrides:
ceilingin classImmutableSortedSet<E>
-
higher
- Specified by:
higherin interfaceNavigableSet<E>- Overrides:
higherin classImmutableSortedSet<E>
-
headSetImpl
- Specified by:
headSetImplin classImmutableSortedSet<E>
-
headIndex
-
subSetImpl
ImmutableSortedSet<E> subSetImpl(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) - Specified by:
subSetImplin classImmutableSortedSet<E>
-
tailSetImpl
- Specified by:
tailSetImplin classImmutableSortedSet<E>
-
tailIndex
-
unsafeComparator
Comparator<Object> unsafeComparator() -
getSubSet
-
indexOf
Description copied from class:ImmutableSortedSetReturns the position of an element within the set, or -1 if not present.- Specified by:
indexOfin classImmutableSortedSet<E>
-
createAsList
ImmutableList<E> createAsList()- Overrides:
createAsListin classImmutableSet.CachingAsList<E>
-
createDescendingSet
ImmutableSortedSet<E> createDescendingSet()- Specified by:
createDescendingSetin classImmutableSortedSet<E>
-