Package com.google.common.collect
Class EmptyContiguousSet<C extends java.lang.Comparable>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- com.google.common.collect.ImmutableCollection<E>
-
- com.google.common.collect.ImmutableSet<E>
-
- com.google.common.collect.ImmutableSortedSetFauxverideShim<E>
-
- com.google.common.collect.ImmutableSortedSet<C>
-
- com.google.common.collect.ContiguousSet<C>
-
- com.google.common.collect.EmptyContiguousSet<C>
-
- All Implemented Interfaces:
SortedIterable<C>
,java.io.Serializable
,java.lang.Iterable<C>
,java.util.Collection<C>
,java.util.NavigableSet<C>
,java.util.Set<C>
,java.util.SortedSet<C>
@GwtCompatible(emulated=true) final class EmptyContiguousSet<C extends java.lang.Comparable> extends ContiguousSet<C>
An empty contiguous set.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
EmptyContiguousSet.SerializedForm<C extends java.lang.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.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
HASH_FLOODING_FPP, MAX_RUN_MULTIPLIER, MAX_TABLE_SIZE
-
-
Constructor Summary
Constructors Constructor Description EmptyContiguousSet(DiscreteDomain<C> domain)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableList<C>
asList()
Returns anImmutableList
containing the same elements, in the same order, as this collection.boolean
contains(java.lang.Object object)
(package private) ImmutableSortedSet<C>
createDescendingSet()
UnmodifiableIterator<C>
descendingIterator()
boolean
equals(java.lang.Object object)
C
first()
int
hashCode()
(package private) ContiguousSet<C>
headSetImpl(C toElement, boolean inclusive)
(package private) int
indexOf(java.lang.Object target)
Returns the position of an element within the set, or -1 if not present.ContiguousSet<C>
intersection(ContiguousSet<C> other)
Returns the set of values that are contained in both this set and the other.boolean
isEmpty()
(package private) boolean
isHashCodeFast()
Returnstrue
if thehashCode()
method runs quickly.(package private) boolean
isPartialView()
Returnstrue
if this immutable collection's implementation contains references to user-created objects that aren't accessible via this collection's methods.UnmodifiableIterator<C>
iterator()
Returns an unmodifiable iterator across the elements in this collection.C
last()
Range<C>
range()
Returns a range, closed on both ends, whose endpoints are the minimum and maximum values contained in this set.Range<C>
range(BoundType lowerBoundType, BoundType upperBoundType)
Returns the minimal range with the given boundary types for which all values in this set are contained within the range.int
size()
(package private) ContiguousSet<C>
subSetImpl(C fromElement, boolean fromInclusive, C toElement, boolean toInclusive)
(package private) ContiguousSet<C>
tailSetImpl(C fromElement, boolean fromInclusive)
java.lang.String
toString()
Returns a short-hand representation of the contents such as"[1..100]"
.(package private) java.lang.Object
writeReplace()
-
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
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, unsafeCompare
-
Methods inherited from class com.google.common.collect.ImmutableSortedSetFauxverideShim
builderWithExpectedSize, copyOf, of, of, of, of, of, of, toImmutableSet
-
Methods inherited from class com.google.common.collect.ImmutableSet
chooseTableSize, createAsList, hashFloodingDetected, maxRunBeforeFallback, rebuildHashTable
-
Methods inherited from class com.google.common.collect.ImmutableCollection
add, addAll, clear, copyIntoArray, remove, removeAll, removeIf, retainAll, toArray, toArray
-
-
-
-
Constructor Detail
-
EmptyContiguousSet
EmptyContiguousSet(DiscreteDomain<C> domain)
-
-
Method Detail
-
first
public C first()
- Specified by:
first
in interfacejava.util.SortedSet<C extends java.lang.Comparable>
- Overrides:
first
in classImmutableSortedSet<C extends java.lang.Comparable>
-
last
public C last()
- Specified by:
last
in interfacejava.util.SortedSet<C extends java.lang.Comparable>
- Overrides:
last
in classImmutableSortedSet<C extends java.lang.Comparable>
-
size
public int size()
-
intersection
public ContiguousSet<C> intersection(ContiguousSet<C> other)
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 java.lang.Comparable>
-
range
public Range<C> 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 java.lang.Comparable>
-
range
public Range<C> range(BoundType lowerBoundType, BoundType upperBoundType)
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 java.lang.Comparable>
-
headSetImpl
ContiguousSet<C> headSetImpl(C toElement, boolean inclusive)
- Specified by:
headSetImpl
in classContiguousSet<C extends java.lang.Comparable>
-
subSetImpl
ContiguousSet<C> subSetImpl(C fromElement, boolean fromInclusive, C toElement, boolean toInclusive)
- Specified by:
subSetImpl
in classContiguousSet<C extends java.lang.Comparable>
-
tailSetImpl
ContiguousSet<C> tailSetImpl(C fromElement, boolean fromInclusive)
- Specified by:
tailSetImpl
in classContiguousSet<C extends java.lang.Comparable>
-
contains
public boolean contains(java.lang.Object object)
- Specified by:
contains
in interfacejava.util.Collection<C extends java.lang.Comparable>
- Specified by:
contains
in interfacejava.util.Set<C extends java.lang.Comparable>
- Specified by:
contains
in classImmutableCollection<C extends java.lang.Comparable>
-
indexOf
@GwtIncompatible int indexOf(java.lang.Object target)
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 java.lang.Comparable>
-
iterator
public UnmodifiableIterator<C> iterator()
Description copied from class:ImmutableCollection
Returns an unmodifiable iterator across the elements in this collection.- Specified by:
iterator
in interfacejava.util.Collection<C extends java.lang.Comparable>
- Specified by:
iterator
in interfacejava.lang.Iterable<C extends java.lang.Comparable>
- Specified by:
iterator
in interfacejava.util.NavigableSet<C extends java.lang.Comparable>
- Specified by:
iterator
in interfacejava.util.Set<C extends java.lang.Comparable>
- Specified by:
iterator
in interfaceSortedIterable<C extends java.lang.Comparable>
- Specified by:
iterator
in classImmutableSortedSet<C extends java.lang.Comparable>
-
descendingIterator
@GwtIncompatible public UnmodifiableIterator<C> descendingIterator()
- Specified by:
descendingIterator
in interfacejava.util.NavigableSet<C extends java.lang.Comparable>
- Specified by:
descendingIterator
in classImmutableSortedSet<C extends java.lang.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 java.lang.Comparable>
-
isEmpty
public boolean isEmpty()
-
asList
public ImmutableList<C> 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<C extends java.lang.Comparable>
-
toString
public java.lang.String toString()
Description copied from class:ContiguousSet
Returns a short-hand representation of the contents such as"[1..100]"
.- Overrides:
toString
in classContiguousSet<C extends java.lang.Comparable>
-
equals
public boolean equals(java.lang.Object object)
- Specified by:
equals
in interfacejava.util.Collection<C extends java.lang.Comparable>
- Specified by:
equals
in interfacejava.util.Set<C extends java.lang.Comparable>
- Overrides:
equals
in classImmutableSet<C extends java.lang.Comparable>
-
isHashCodeFast
@GwtIncompatible boolean isHashCodeFast()
Description copied from class:ImmutableSet
Returnstrue
if thehashCode()
method runs quickly.- Overrides:
isHashCodeFast
in classImmutableSet<C extends java.lang.Comparable>
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfacejava.util.Collection<C extends java.lang.Comparable>
- Specified by:
hashCode
in interfacejava.util.Set<C extends java.lang.Comparable>
- Overrides:
hashCode
in classImmutableSet<C extends java.lang.Comparable>
-
writeReplace
@GwtIncompatible java.lang.Object writeReplace()
- Overrides:
writeReplace
in classImmutableSortedSet<C extends java.lang.Comparable>
-
createDescendingSet
@GwtIncompatible ImmutableSortedSet<C> createDescendingSet()
- Overrides:
createDescendingSet
in classContiguousSet<C extends java.lang.Comparable>
-
-