com.google.common.collect
@Beta @GwtCompatible public abstract class ContiguousSet<C extends java.lang.Comparable> extends ImmutableSortedSet<C>
DiscreteDomain.ImmutableSortedSet.Builder<E>| Modifier and Type | Method and Description |
|---|---|
static <E> ImmutableSortedSet.Builder<E> |
builder()
Deprecated.
Use
ImmutableSortedSet.naturalOrder(), which offers
better type-safety. |
ContiguousSet<C> |
headSet(C toElement) |
abstract ContiguousSet<C> |
intersection(ContiguousSet<C> other)
Returns the set of values that are contained in both this set and the other.
|
abstract Range<C> |
range()
Returns a range, closed on both ends, whose endpoints are the minimum and maximum values
contained in this set.
|
abstract 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.
|
ContiguousSet<C> |
subSet(C fromElement,
C toElement) |
ContiguousSet<C> |
tailSet(C fromElement) |
java.lang.String |
toString()
Returns a short-hand representation of the contents such as
"[1..100]". |
comparator, copyOf, copyOf, copyOf, copyOf, copyOf, copyOf, copyOf, copyOfSorted, iterator, naturalOrder, of, of, of, of, of, of, of, orderedBy, reverseOrderequals, hashCodeadd, addAll, asList, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArraypublic ContiguousSet<C> headSet(C toElement)
ImmutableSortedSetThis method returns a serializable ImmutableSortedSet.
The SortedSet.headSet(E) documentation states that a subset of a
subset throws an IllegalArgumentException if passed a
toElement greater than an earlier toElement. However, this
method doesn't throw an exception in that situation, but instead keeps the
original toElement.
headSet in interface java.util.SortedSet<C extends java.lang.Comparable>headSet in class ImmutableSortedSet<C extends java.lang.Comparable>public ContiguousSet<C> subSet(C fromElement, C toElement)
ImmutableSortedSetThis method returns a serializable ImmutableSortedSet.
The SortedSet.subSet(E, E) documentation states that a subset of a
subset throws an IllegalArgumentException if passed a
fromElement smaller than an earlier fromElement. However,
this method doesn't throw an exception in that situation, but instead keeps
the original fromElement. Similarly, this method keeps the
original toElement, instead of throwing an exception, if passed a
toElement greater than an earlier toElement.
subSet in interface java.util.SortedSet<C extends java.lang.Comparable>subSet in class ImmutableSortedSet<C extends java.lang.Comparable>public ContiguousSet<C> tailSet(C fromElement)
ImmutableSortedSetThis method returns a serializable ImmutableSortedSet.
The SortedSet.tailSet(E) documentation states that a subset of a
subset throws an IllegalArgumentException if passed a
fromElement smaller than an earlier fromElement. However,
this method doesn't throw an exception in that situation, but instead keeps
the original fromElement.
tailSet in interface java.util.SortedSet<C extends java.lang.Comparable>tailSet in class ImmutableSortedSet<C extends java.lang.Comparable>public abstract ContiguousSet<C> intersection(ContiguousSet<C> other)
This method should always be used instead of
Sets.intersection(java.util.Set for ContiguousSet instances.
public abstract Range<C> range()
range(CLOSED, CLOSED).java.util.NoSuchElementException - if this set is emptypublic abstract Range<C> range(BoundType lowerBoundType, BoundType upperBoundType)
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..???).
java.util.NoSuchElementException - if this set is emptypublic java.lang.String toString()
"[1..100]".toString in class ImmutableCollection<C extends java.lang.Comparable>@Deprecated public static <E> ImmutableSortedSet.Builder<E> builder()
ImmutableSortedSet.naturalOrder(), which offers
better type-safety.ImmutableSortedSet.naturalOrder(), which offers
better type-safety, instead. This method exists only to hide
ImmutableSet.builder() from consumers of ImmutableSortedSet.java.lang.UnsupportedOperationException - always