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 classEmptyContiguousSet.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 anImmutableListcontaining the same elements, in the same order, as this collection.booleancontains(java.lang.Object object)(package private) ImmutableSortedSet<C>createDescendingSet()UnmodifiableIterator<C>descendingIterator()booleanequals(java.lang.Object object)Cfirst()inthashCode()(package private) ContiguousSet<C>headSetImpl(C toElement, boolean inclusive)(package private) intindexOf(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.booleanisEmpty()(package private) booleanisHashCodeFast()Returnstrueif thehashCode()method runs quickly.(package private) booleanisPartialView()Returnstrueif 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.Clast()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.intsize()(package private) ContiguousSet<C>subSetImpl(C fromElement, boolean fromInclusive, C toElement, boolean toInclusive)(package private) ContiguousSet<C>tailSetImpl(C fromElement, boolean fromInclusive)java.lang.StringtoString()Returns a short-hand representation of the contents such as"[1..100]".(package private) java.lang.ObjectwriteReplace()-
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, rebuildHashTable
-
Methods inherited from class com.google.common.collect.ImmutableCollection
add, addAll, clear, copyIntoArray, internalArray, internalArrayEnd, internalArrayStart, remove, removeAll, removeIf, retainAll, toArray, toArray
-
-
-
-
Constructor Detail
-
EmptyContiguousSet
EmptyContiguousSet(DiscreteDomain<C> domain)
-
-
Method Detail
-
first
public C first()
- Specified by:
firstin interfacejava.util.SortedSet<C extends java.lang.Comparable>- Overrides:
firstin classImmutableSortedSet<C extends java.lang.Comparable>
-
last
public C last()
- Specified by:
lastin interfacejava.util.SortedSet<C extends java.lang.Comparable>- Overrides:
lastin classImmutableSortedSet<C extends java.lang.Comparable>
-
size
public int size()
-
intersection
public ContiguousSet<C> intersection(ContiguousSet<C> other)
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 java.lang.Comparable>
-
range
public Range<C> 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 java.lang.Comparable>
-
range
public Range<C> range(BoundType lowerBoundType, BoundType upperBoundType)
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 java.lang.Comparable>
-
headSetImpl
ContiguousSet<C> headSetImpl(C toElement, boolean inclusive)
- Specified by:
headSetImplin classContiguousSet<C extends java.lang.Comparable>
-
subSetImpl
ContiguousSet<C> subSetImpl(C fromElement, boolean fromInclusive, C toElement, boolean toInclusive)
- Specified by:
subSetImplin classContiguousSet<C extends java.lang.Comparable>
-
tailSetImpl
ContiguousSet<C> tailSetImpl(C fromElement, boolean fromInclusive)
- Specified by:
tailSetImplin classContiguousSet<C extends java.lang.Comparable>
-
contains
public boolean contains(java.lang.Object object)
- Specified by:
containsin interfacejava.util.Collection<C extends java.lang.Comparable>- Specified by:
containsin interfacejava.util.Set<C extends java.lang.Comparable>- Specified by:
containsin classImmutableCollection<C extends java.lang.Comparable>
-
indexOf
@GwtIncompatible int indexOf(java.lang.Object target)
Description copied from class:ImmutableSortedSetReturns the position of an element within the set, or -1 if not present.- Specified by:
indexOfin classImmutableSortedSet<C extends java.lang.Comparable>
-
iterator
public UnmodifiableIterator<C> iterator()
Description copied from class:ImmutableCollectionReturns an unmodifiable iterator across the elements in this collection.- Specified by:
iteratorin interfacejava.util.Collection<C extends java.lang.Comparable>- Specified by:
iteratorin interfacejava.lang.Iterable<C extends java.lang.Comparable>- Specified by:
iteratorin interfacejava.util.NavigableSet<C extends java.lang.Comparable>- Specified by:
iteratorin interfacejava.util.Set<C extends java.lang.Comparable>- Specified by:
iteratorin interfaceSortedIterable<C extends java.lang.Comparable>- Specified by:
iteratorin classImmutableSortedSet<C extends java.lang.Comparable>
-
descendingIterator
@GwtIncompatible public UnmodifiableIterator<C> descendingIterator()
- Specified by:
descendingIteratorin interfacejava.util.NavigableSet<C extends java.lang.Comparable>- Specified by:
descendingIteratorin classImmutableSortedSet<C extends java.lang.Comparable>
-
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 java.lang.Comparable>
-
isEmpty
public boolean isEmpty()
-
asList
public ImmutableList<C> asList()
Description copied from class:ImmutableCollectionReturns anImmutableListcontaining 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:
asListin classImmutableSet<C extends java.lang.Comparable>
-
toString
public java.lang.String toString()
Description copied from class:ContiguousSetReturns a short-hand representation of the contents such as"[1..100]".- Overrides:
toStringin classContiguousSet<C extends java.lang.Comparable>
-
equals
public boolean equals(java.lang.Object object)
- Specified by:
equalsin interfacejava.util.Collection<C extends java.lang.Comparable>- Specified by:
equalsin interfacejava.util.Set<C extends java.lang.Comparable>- Overrides:
equalsin classImmutableSet<C extends java.lang.Comparable>
-
isHashCodeFast
@GwtIncompatible boolean isHashCodeFast()
Description copied from class:ImmutableSetReturnstrueif thehashCode()method runs quickly.- Overrides:
isHashCodeFastin classImmutableSet<C extends java.lang.Comparable>
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfacejava.util.Collection<C extends java.lang.Comparable>- Specified by:
hashCodein interfacejava.util.Set<C extends java.lang.Comparable>- Overrides:
hashCodein classImmutableSet<C extends java.lang.Comparable>
-
writeReplace
@GwtIncompatible java.lang.Object writeReplace()
- Overrides:
writeReplacein classImmutableSortedSet<C extends java.lang.Comparable>
-
createDescendingSet
@GwtIncompatible ImmutableSortedSet<C> createDescendingSet()
- Overrides:
createDescendingSetin classContiguousSet<C extends java.lang.Comparable>
-
-