Package com.google.common.collect
Class RegularContiguousSet<C extends Comparable>
java.lang.Object
java.util.AbstractCollection<C>
com.google.common.collect.ImmutableCollection<C>
com.google.common.collect.ImmutableSet<C>
com.google.common.collect.ImmutableSet.CachingAsList<C>
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>
,SequencedCollection<C>
,SequencedSet<C>
,Set<C>
,SortedSet<C>
An implementation of
ContiguousSet
that contains one or more elements.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
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 static final long
Fields inherited from class com.google.common.collect.ContiguousSet
domain
Fields inherited from class com.google.common.collect.ImmutableSortedSet
comparator, descendingSet, SPLITERATOR_CHARACTERISTICS
Fields inherited from class com.google.common.collect.ImmutableSet
MAX_TABLE_SIZE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
containsAll
(Collection<?> targets) (package private) ImmutableList
<C> boolean
private static boolean
equalsOrThrow
(Comparable<?> left, Comparable<?> right) first()
int
hashCode()
(package private) ContiguousSet
<C> headSetImpl
(C toElement, boolean inclusive) (package private) int
Returns 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) boolean
isEmpty()
(package private) boolean
Returnstrue
if 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.private void
readObject
(ObjectInputStream stream) int
size()
(package private) ContiguousSet
<C> subSetImpl
(C fromElement, boolean fromInclusive, C toElement, boolean toInclusive) (package private) ContiguousSet
<C> tailSetImpl
(C fromElement, boolean inclusive) (package private) Object
Methods inherited from class com.google.common.collect.ContiguousSet
builder, closed, closed, closedOpen, closedOpen, create, createDescendingSet, headSet, headSet, subSet, subSet, tailSet, tailSet, toString
Methods inherited from class com.google.common.collect.ImmutableSortedSet
builderWithExpectedSize, ceiling, comparator, construct, copyOf, 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, toImmutableSet, toImmutableSortedSet, unsafeCompare, unsafeCompare
Methods inherited from class com.google.common.collect.ImmutableSet.CachingAsList
asList
Methods inherited from class com.google.common.collect.ImmutableSet
chooseTableSize, isHashCodeFast
Methods inherited from class com.google.common.collect.ImmutableCollection
add, addAll, clear, copyIntoArray, internalArray, internalArrayEnd, internalArrayStart, remove, removeAll, removeIf, retainAll, toArray, toArray
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.NavigableSet
removeFirst, removeLast, reversed
-
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:
headSetImpl
in classContiguousSet<C extends Comparable>
-
subSetImpl
- Specified by:
subSetImpl
in classContiguousSet<C extends Comparable>
-
tailSetImpl
- Specified by:
tailSetImpl
in classContiguousSet<C extends Comparable>
-
indexOf
Description copied from class:ImmutableSortedSet
Returns the position of an element within the set, or -1 if not present.- Specified by:
indexOf
in classImmutableSortedSet<C extends Comparable>
-
iterator
Description copied from class:ImmutableCollection
Returns an unmodifiable iterator across the elements in this collection.- Specified by:
iterator
in interfaceCollection<C extends Comparable>
- Specified by:
iterator
in interfaceIterable<C extends Comparable>
- Specified by:
iterator
in interfaceNavigableSet<C extends Comparable>
- Specified by:
iterator
in interfaceSet<C extends Comparable>
- Specified by:
iterator
in interfaceSortedIterable<C extends Comparable>
- Specified by:
iterator
in classImmutableSortedSet<C extends Comparable>
-
descendingIterator
- Specified by:
descendingIterator
in interfaceNavigableSet<C extends Comparable>
- Specified by:
descendingIterator
in classImmutableSortedSet<C extends Comparable>
-
equalsOrThrow
-
isPartialView
boolean isPartialView()Description copied from class:ImmutableCollection
Returnstrue
if 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 whethercopyOf
implementations should make an explicit copy to avoid memory leaks.- Specified by:
isPartialView
in classImmutableCollection<C extends Comparable>
-
first
- Specified by:
first
in interfaceSortedSet<C extends Comparable>
- Overrides:
first
in classImmutableSortedSet<C extends Comparable>
-
last
- Specified by:
last
in interfaceSortedSet<C extends Comparable>
- Overrides:
last
in classImmutableSortedSet<C extends Comparable>
-
createAsList
ImmutableList<C> createAsList()- Overrides:
createAsList
in classImmutableSet.CachingAsList<C extends Comparable>
-
size
public int size()- Specified by:
size
in interfaceCollection<C extends Comparable>
- Specified by:
size
in interfaceSet<C extends Comparable>
- Specified by:
size
in classAbstractCollection<C extends Comparable>
-
contains
- Specified by:
contains
in interfaceCollection<C extends Comparable>
- Specified by:
contains
in interfaceSet<C extends Comparable>
- Specified by:
contains
in classImmutableCollection<C extends Comparable>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<C extends Comparable>
- Specified by:
containsAll
in interfaceSet<C extends Comparable>
- Overrides:
containsAll
in classAbstractCollection<C extends Comparable>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<C extends Comparable>
- Specified by:
isEmpty
in interfaceSet<C extends Comparable>
- Overrides:
isEmpty
in classAbstractCollection<C extends Comparable>
-
intersection
Description copied from class:ContiguousSet
Returns 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<?>)
forContiguousSet
instances.- Specified by:
intersection
in classContiguousSet<C extends Comparable>
-
range
Description copied from class:ContiguousSet
Returns 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:
range
in classContiguousSet<C extends Comparable>
-
range
Description copied from class:ContiguousSet
Returns 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.OPEN
is requested for a domain minimum or maximum. For example, ifset
was created from the range[1..Integer.MAX_VALUE]
thenset.range(CLOSED, OPEN)
must return[1..∞)
.- Specified by:
range
in classContiguousSet<C extends Comparable>
-
equals
- Specified by:
equals
in interfaceCollection<C extends Comparable>
- Specified by:
equals
in interfaceSet<C extends Comparable>
- Overrides:
equals
in classImmutableSet<C extends Comparable>
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<C extends Comparable>
- Specified by:
hashCode
in interfaceSet<C extends Comparable>
- Overrides:
hashCode
in classImmutableSet<C extends Comparable>
-
writeReplace
Object writeReplace()- Overrides:
writeReplace
in classContiguousSet<C extends Comparable>
-
readObject
- Throws:
InvalidObjectException
-