Package com.google.common.collect
Class RegularContiguousSet<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.RegularContiguousSet<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>
final class RegularContiguousSet<C extends java.lang.Comparable> extends ContiguousSet<C>
An implementation ofContiguousSetthat contains one or more elements.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classRegularContiguousSet.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 Modifier and Type Field Description private Range<C>rangeprivate static longserialVersionUID-
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 RegularContiguousSet(Range<C> range, DiscreteDomain<C> domain)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(java.lang.Object object)booleancontainsAll(java.util.Collection<?> targets)(package private) ImmutableList<C>createAsList()UnmodifiableIterator<C>descendingIterator()booleanequals(java.lang.Object object)private static booleanequalsOrThrow(java.lang.Comparable<?> left, java.lang.Comparable<?> right)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.private ContiguousSet<C>intersectionInCurrentDomain(Range<C> other)booleanisEmpty()(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 inclusive)(package private) java.lang.ObjectwriteReplace()-
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
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
asList, chooseTableSize, hashFloodingDetected, isHashCodeFast, rebuildHashTable
-
Methods inherited from class com.google.common.collect.ImmutableCollection
add, addAll, clear, copyIntoArray, internalArray, internalArrayEnd, internalArrayStart, remove, removeAll, removeIf, retainAll, toArray, toArray
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RegularContiguousSet
RegularContiguousSet(Range<C> range, DiscreteDomain<C> domain)
-
-
Method Detail
-
intersectionInCurrentDomain
private ContiguousSet<C> intersectionInCurrentDomain(Range<C> other)
-
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 inclusive)
- Specified by:
tailSetImplin classContiguousSet<C extends java.lang.Comparable>
-
indexOf
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
public UnmodifiableIterator<C> descendingIterator()
- Specified by:
descendingIteratorin interfacejava.util.NavigableSet<C extends java.lang.Comparable>- Specified by:
descendingIteratorin classImmutableSortedSet<C extends java.lang.Comparable>
-
equalsOrThrow
private static boolean equalsOrThrow(java.lang.Comparable<?> left, java.lang.Comparable<?> right)
-
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>
-
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>
-
createAsList
ImmutableList<C> createAsList()
- Overrides:
createAsListin classImmutableSet<C extends java.lang.Comparable>
-
size
public int size()
-
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>
-
containsAll
public boolean containsAll(java.util.Collection<?> targets)
-
isEmpty
public boolean isEmpty()
-
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>
-
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>
-
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
java.lang.Object writeReplace()
- Overrides:
writeReplacein classImmutableSortedSet<C extends java.lang.Comparable>
-
-