Package com.google.common.collect
Class RegularContiguousSet<C extends Comparable>
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<C>
com.google.common.collect.ContiguousSet<C>
com.google.common.collect.RegularContiguousSet<C>
- All Implemented Interfaces:
SortedIterable<C>,Serializable,Iterable<C>,Collection<C>,NavigableSet<C>,Set<C>,SortedSet<C>
An implementation of
ContiguousSet that contains one or more elements.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classNested 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 static final longFields inherited from class com.google.common.collect.ContiguousSet
domainFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleancontainsAll(Collection<?> targets) (package private) ImmutableList<C>booleanprivate static booleanequalsOrThrow(Comparable<?> left, Comparable<?> right) first()inthashCode()(package private) ContiguousSet<C>headSetImpl(C toElement, boolean inclusive) (package private) intReturns the position of an element within the set, or -1 if not present.intersection(ContiguousSet<C> other) Returns the set of values that are contained in both this set and the other.private ContiguousSet<C>intersectionInCurrentDomain(Range<C> other) booleanisEmpty()(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()range()Returns a range, closed on both ends, whose endpoints are the minimum and maximum values contained in this set.Returns the minimal range with the given boundary types for which all values in this set are contained within the range.intsize()(package private) ContiguousSet<C>subSetImpl(C fromElement, boolean fromInclusive, C toElement, boolean toInclusive) (package private) ContiguousSet<C>tailSetImpl(C fromElement, boolean inclusive) (package private) ObjectMethods inherited from class com.google.common.collect.ContiguousSet
builder, closed, closed, closedOpen, closedOpen, create, createDescendingSet, headSet, headSet, subSet, subSet, tailSet, tailSet, toStringMethods inherited from class com.google.common.collect.ImmutableSortedSet
ceiling, comparator, construct, copyOf, copyOf, copyOf, copyOf, copyOf, copyOf, copyOf, copyOfSorted, descendingSet, emptySet, floor, higher, lower, naturalOrder, of, of, of, of, of, of, of, orderedBy, pollFirst, pollLast, reverseOrder, spliterator, toImmutableSortedSet, unsafeCompare, unsafeCompareMethods inherited from class com.google.common.collect.ImmutableSortedSetFauxverideShim
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, isHashCodeFastMethods inherited from class com.google.common.collect.ImmutableCollection
add, addAll, clear, copyIntoArray, internalArray, internalArrayEnd, internalArrayStart, remove, removeAll, removeIf, retainAll, toArray, toArrayMethods 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
-
range
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
RegularContiguousSet
RegularContiguousSet(Range<C> range, DiscreteDomain<C> domain)
-
-
Method Details
-
intersectionInCurrentDomain
-
headSetImpl
- Specified by:
headSetImplin classContiguousSet<C extends Comparable>
-
subSetImpl
- Specified by:
subSetImplin classContiguousSet<C extends Comparable>
-
tailSetImpl
- Specified by:
tailSetImplin classContiguousSet<C extends Comparable>
-
indexOf
Description copied from class:ImmutableSortedSetReturns the position of an element within the set, or -1 if not present.- Specified by:
indexOfin classImmutableSortedSet<C extends Comparable>
-
iterator
Description copied from class:ImmutableCollectionReturns an unmodifiable iterator across the elements in this collection.- Specified by:
iteratorin interfaceCollection<C extends Comparable>- Specified by:
iteratorin interfaceIterable<C extends Comparable>- Specified by:
iteratorin interfaceNavigableSet<C extends Comparable>- Specified by:
iteratorin interfaceSet<C extends Comparable>- Specified by:
iteratorin interfaceSortedIterable<C extends Comparable>- Specified by:
iteratorin classImmutableSortedSet<C extends Comparable>
-
descendingIterator
- Specified by:
descendingIteratorin interfaceNavigableSet<C extends Comparable>- Specified by:
descendingIteratorin classImmutableSortedSet<C extends Comparable>
-
equalsOrThrow
-
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<C extends Comparable>
-
first
- Specified by:
firstin interfaceSortedSet<C extends Comparable>- Overrides:
firstin classImmutableSortedSet<C extends Comparable>
-
last
- Specified by:
lastin interfaceSortedSet<C extends Comparable>- Overrides:
lastin classImmutableSortedSet<C extends Comparable>
-
createAsList
ImmutableList<C> createAsList()- Overrides:
createAsListin classImmutableSet.CachingAsList<C extends Comparable>
-
size
public int size()- Specified by:
sizein interfaceCollection<C extends Comparable>- Specified by:
sizein interfaceSet<C extends Comparable>- Specified by:
sizein classAbstractCollection<C extends Comparable>
-
contains
- Specified by:
containsin interfaceCollection<C extends Comparable>- Specified by:
containsin interfaceSet<C extends Comparable>- Specified by:
containsin classImmutableCollection<C extends Comparable>
-
containsAll
- Specified by:
containsAllin interfaceCollection<C extends Comparable>- Specified by:
containsAllin interfaceSet<C extends Comparable>- Overrides:
containsAllin classAbstractCollection<C extends Comparable>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<C extends Comparable>- Specified by:
isEmptyin interfaceSet<C extends Comparable>- Overrides:
isEmptyin classAbstractCollection<C extends Comparable>
-
intersection
Description copied from class:ContiguousSetReturns the set of values that are contained in both this set and the other.This method should always be used instead of
Sets.intersection(java.util.Set<E>, java.util.Set<?>)forContiguousSetinstances.- Specified by:
intersectionin classContiguousSet<C extends Comparable>
-
range
Description copied from class:ContiguousSetReturns a range, closed on both ends, whose endpoints are the minimum and maximum values contained in this set. This is equivalent torange(CLOSED, CLOSED).- Specified by:
rangein classContiguousSet<C extends Comparable>
-
range
Description copied from class:ContiguousSetReturns the minimal range with the given boundary types for which all values in this set are contained within the range.Note that this method will return ranges with unbounded endpoints if
BoundType.OPENis requested for a domain minimum or maximum. For example, ifsetwas created from the range[1..Integer.MAX_VALUE]thenset.range(CLOSED, OPEN)must return[1..∞).- Specified by:
rangein classContiguousSet<C extends Comparable>
-
equals
- Specified by:
equalsin interfaceCollection<C extends Comparable>- Specified by:
equalsin interfaceSet<C extends Comparable>- Overrides:
equalsin classImmutableSet<C extends Comparable>
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<C extends Comparable>- Specified by:
hashCodein interfaceSet<C extends Comparable>- Overrides:
hashCodein classImmutableSet<C extends Comparable>
-
writeReplace
Object writeReplace()- Overrides:
writeReplacein classImmutableSortedSet<C extends Comparable>
-