final class RegularContiguousSet<C extends java.lang.Comparable> extends ContiguousSet<C>
ContiguousSet
that contains one or more elements.Modifier and Type | Class and Description |
---|---|
private static class |
RegularContiguousSet.SerializedForm<C extends java.lang.Comparable> |
ImmutableSortedSet.Builder<E>
ImmutableSet.Indexed<E>
Modifier and Type | Field and Description |
---|---|
private Range<C> |
range |
private static long |
serialVersionUID |
domain
comparator, descendingSet, SPLITERATOR_CHARACTERISTICS
HASH_FLOODING_FPP, MAX_RUN_MULTIPLIER, MAX_TABLE_SIZE
Constructor and Description |
---|
RegularContiguousSet(Range<C> range,
DiscreteDomain<C> domain) |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(java.lang.Object object) |
boolean |
containsAll(java.util.Collection<?> targets) |
(package private) ImmutableList<C> |
createAsList() |
UnmodifiableIterator<C> |
descendingIterator() |
boolean |
equals(java.lang.Object object) |
private static boolean |
equalsOrThrow(java.lang.Comparable<?> left,
java.lang.Comparable<?> right) |
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.
|
private ContiguousSet<C> |
intersectionInCurrentDomain(Range<C> other) |
boolean |
isEmpty() |
(package private) boolean |
isPartialView()
Returns
true 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 inclusive) |
(package private) java.lang.Object |
writeReplace() |
builder, closed, closed, closedOpen, closedOpen, create, createDescendingSet, headSet, headSet, subSet, subSet, tailSet, tailSet, toString
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
builderWithExpectedSize, toImmutableSet
asList, chooseTableSize, hashFloodingDetected, isHashCodeFast, rebuildHashTable
add, addAll, clear, copyIntoArray, internalArray, internalArrayEnd, internalArrayStart, remove, removeAll, removeIf, retainAll, toArray, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
private static final long serialVersionUID
RegularContiguousSet(Range<C> range, DiscreteDomain<C> domain)
private ContiguousSet<C> intersectionInCurrentDomain(Range<C> other)
ContiguousSet<C> headSetImpl(C toElement, boolean inclusive)
headSetImpl
in class ContiguousSet<C extends java.lang.Comparable>
ContiguousSet<C> subSetImpl(C fromElement, boolean fromInclusive, C toElement, boolean toInclusive)
subSetImpl
in class ContiguousSet<C extends java.lang.Comparable>
ContiguousSet<C> tailSetImpl(C fromElement, boolean inclusive)
tailSetImpl
in class ContiguousSet<C extends java.lang.Comparable>
int indexOf(java.lang.Object target)
ImmutableSortedSet
indexOf
in class ImmutableSortedSet<C extends java.lang.Comparable>
public UnmodifiableIterator<C> iterator()
ImmutableCollection
iterator
in interface SortedIterable<C extends java.lang.Comparable>
iterator
in interface java.lang.Iterable<C extends java.lang.Comparable>
iterator
in interface java.util.Collection<C extends java.lang.Comparable>
iterator
in interface java.util.NavigableSet<C extends java.lang.Comparable>
iterator
in interface java.util.Set<C extends java.lang.Comparable>
iterator
in class ImmutableSortedSet<C extends java.lang.Comparable>
public UnmodifiableIterator<C> descendingIterator()
descendingIterator
in interface java.util.NavigableSet<C extends java.lang.Comparable>
descendingIterator
in class ImmutableSortedSet<C extends java.lang.Comparable>
private static boolean equalsOrThrow(java.lang.Comparable<?> left, java.lang.Comparable<?> right)
boolean isPartialView()
ImmutableCollection
true
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 whether copyOf
implementations should make an explicit copy to avoid
memory leaks.isPartialView
in class ImmutableCollection<C extends java.lang.Comparable>
public C first()
first
in interface java.util.SortedSet<C extends java.lang.Comparable>
first
in class ImmutableSortedSet<C extends java.lang.Comparable>
public C last()
last
in interface java.util.SortedSet<C extends java.lang.Comparable>
last
in class ImmutableSortedSet<C extends java.lang.Comparable>
ImmutableList<C> createAsList()
createAsList
in class ImmutableSet<C extends java.lang.Comparable>
public int size()
public boolean contains(java.lang.Object object)
contains
in interface java.util.Collection<C extends java.lang.Comparable>
contains
in interface java.util.Set<C extends java.lang.Comparable>
contains
in class ImmutableCollection<C extends java.lang.Comparable>
public boolean containsAll(java.util.Collection<?> targets)
public boolean isEmpty()
public ContiguousSet<C> intersection(ContiguousSet<C> other)
ContiguousSet
This method should always be used instead of Sets.intersection(java.util.Set<E>, java.util.Set<?>)
for ContiguousSet
instances.
intersection
in class ContiguousSet<C extends java.lang.Comparable>
public Range<C> range()
ContiguousSet
range(CLOSED, CLOSED)
.range
in class ContiguousSet<C extends java.lang.Comparable>
public Range<C> range(BoundType lowerBoundType, BoundType upperBoundType)
ContiguousSet
Note that this method will return ranges with unbounded endpoints if BoundType.OPEN
is requested for a domain minimum or maximum. For example, if set
was created from the
range [1..Integer.MAX_VALUE]
then set.range(CLOSED, OPEN)
must return [1..∞)
.
range
in class ContiguousSet<C extends java.lang.Comparable>
public boolean equals(java.lang.Object object)
equals
in interface java.util.Collection<C extends java.lang.Comparable>
equals
in interface java.util.Set<C extends java.lang.Comparable>
equals
in class ImmutableSet<C extends java.lang.Comparable>
public int hashCode()
hashCode
in interface java.util.Collection<C extends java.lang.Comparable>
hashCode
in interface java.util.Set<C extends java.lang.Comparable>
hashCode
in class ImmutableSet<C extends java.lang.Comparable>
java.lang.Object writeReplace()
writeReplace
in class ImmutableSortedSet<C extends java.lang.Comparable>