Package com.google.common.collect
Class EmptyContiguousSet<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.EmptyContiguousSet<C>
- All Implemented Interfaces:
SortedIterable<C>
,Serializable
,Iterable<C>
,Collection<C>
,NavigableSet<C>
,SequencedCollection<C>
,SequencedSet<C>
,Set<C>
,SortedSet<C>
An empty contiguous set.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
EmptyContiguousSet.SerializedForm<C extends Comparable>
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
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 TypeMethodDescriptionasList()
Returns anImmutableList
containing the same elements, in the same order, as this collection.boolean
(package private) ImmutableSortedSet
<C> boolean
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.boolean
isEmpty()
(package private) boolean
Returnstrue
if thehashCode()
method runs quickly.(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 fromInclusive) toString()
Returns a shorthand representation of the contents such as"[1..100]"
.(package private) Object
Methods inherited from class com.google.common.collect.ContiguousSet
builder, closed, closed, closedOpen, closedOpen, create, headSet, headSet, subSet, subSet, tailSet, tailSet
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
createAsList
Methods inherited from class com.google.common.collect.ImmutableSet
chooseTableSize
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.util.AbstractCollection
containsAll
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
-
Constructor Details
-
EmptyContiguousSet
EmptyContiguousSet(DiscreteDomain<C> domain)
-
-
Method Details
-
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>
-
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>
-
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>
-
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>
-
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>
-
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>
-
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>
-
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>
-
asList
Description copied from class:ImmutableCollection
Returns anImmutableList
containing the same elements, in the same order, as this collection.Performance note: in most cases this method can return quickly without actually copying anything. The exact circumstances under which the copy is performed are undefined and subject to change.
- Overrides:
asList
in classImmutableSet.CachingAsList<C extends Comparable>
-
toString
Description copied from class:ContiguousSet
Returns a shorthand representation of the contents such as"[1..100]"
.- Overrides:
toString
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>
-
isHashCodeFast
boolean isHashCodeFast()Description copied from class:ImmutableSet
Returnstrue
if thehashCode()
method runs quickly.- Overrides:
isHashCodeFast
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
-
createDescendingSet
ImmutableSortedSet<C> createDescendingSet()- Overrides:
createDescendingSet
in classContiguousSet<C extends Comparable>
-