Top Description Inners Fields Constructors Methods
com.google.common.collect

pack-priv final Class RegularContiguousSet<C extends Comparable<T>>

extends ContiguousSet<C extends Comparable<T>>
Class Inheritance
Annotations
@GwtCompatible
emulated:true
@SuppressWarnings:rawtypes
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkArgument, .Preconditions.checkElementIndex, .Preconditions.checkNotNull, com.google.common.collect.BoundType.CLOSED, java.util.Objects.requireNonNull

An implementation of ContiguousSet that contains one or more elements.
Author
Gregory Kick

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final Range<C>
private static final long
Inherited from com.google.common.collect.ContiguousSet:
domain

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
contains(Object
element whose presence in this set is to be tested
object
)

Implements abstract com.google.common.collect.ImmutableCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Returns true if this set contains the specified element.
public boolean
containsAll(Collection<?>
collection to be checked for containment in this set
targets
)

Overrides java.util.AbstractCollection.containsAll.

Implements java.util.Set.containsAll, java.util.Collection.containsAll.

Returns true if this set contains all of the elements of the specified collection.
pack-priv ImmutableList<C>
public UnmodifiableIterator<C>
descendingIterator()

Implements abstract com.google.common.collect.ImmutableSortedSet.descendingIterator.

Implements java.util.NavigableSet.descendingIterator.

Returns an iterator over the elements in this set, in descending order.
public boolean
equals(Object
object to be compared for equality with this set
object
)

Overrides com.google.common.collect.ImmutableSet.equals.

Implements java.util.Set.equals, java.util.Collection.equals.

Compares the specified object with this set for equality.
private static boolean
equalsOrThrow(Comparable<?> left, Comparable<?> right)

public C
first()

Overrides com.google.common.collect.ImmutableSortedSet.first.

Implements java.util.SortedSet.first.

Returns the first (lowest) element currently in this set.
public int
hashCode()

Overrides com.google.common.collect.ImmutableSet.hashCode.

Implements java.util.Set.hashCode, java.util.Collection.hashCode.

Returns the hash code value for this set.
pack-priv ContiguousSet<C>
headSetImpl(C toElement, boolean inclusive)

Implements abstract com.google.common.collect.ContiguousSet.headSetImpl.

pack-priv int
indexOf(Object target)

Implements abstract com.google.common.collect.ImmutableSortedSet.indexOf.

Returns the position of an element within the set, or -1 if not present.
public ContiguousSet<C>
intersection(ContiguousSet<C> other)

Implements abstract com.google.common.collect.ContiguousSet.intersection.

Returns the set of values that are contained in both this set and the other.
private ContiguousSet<C>
public boolean
isEmpty()

Overrides java.util.AbstractCollection.isEmpty.

Implements java.util.Set.isEmpty, java.util.Collection.isEmpty.

Returns true if this set contains no elements.
pack-priv boolean
isPartialView()

Implements abstract com.google.common.collect.ImmutableCollection.isPartialView.

Returns true if this immutable collection's implementation contains references to user-created objects that aren't accessible via this collection's methods.
public UnmodifiableIterator<C>
public C
last()

Overrides com.google.common.collect.ImmutableSortedSet.last.

Implements java.util.SortedSet.last.

Returns the last (highest) element currently in this set.
public Range<C>
range()

Implements abstract com.google.common.collect.ContiguousSet.range.

Returns a range, closed on both ends, whose endpoints are the minimum and maximum values contained in this set.
public Range<C>
range(BoundType lowerBoundType, BoundType upperBoundType)

Implements abstract com.google.common.collect.ContiguousSet.range.

Returns the minimal range with the given boundary types for which all values in this set are contained within the range.
private void
public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Returns the number of elements in this set (its cardinality).
pack-priv ContiguousSet<C>
subSetImpl(C fromElement, boolean fromInclusive, C toElement, boolean toInclusive)

Implements abstract com.google.common.collect.ContiguousSet.subSetImpl.

pack-priv ContiguousSet<C>
tailSetImpl(C fromElement, boolean inclusive)

Implements abstract com.google.common.collect.ContiguousSet.tailSetImpl.

pack-priv Object
Inherited from com.google.common.collect.ContiguousSet:
builderclosedclosedclosedOpenclosedOpencreatecreateDescendingSetheadSetheadSetsubSetsubSettailSettailSettoString

Field Detail

rangeback to summary
private final Range<C> range
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.google.common.collect.ImmutableSortedSet.serialVersionUID.

Constructor Detail

RegularContiguousSetback to summary
pack-priv RegularContiguousSet(Range<C> range, DiscreteDomain<C> domain)

Method Detail

containsback to summary
public boolean contains(Object object)

Implements abstract com.google.common.collect.ImmutableCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Doc from java.util.Set.contains.

Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that Objects.equals(o, e).

Parameters
object:Object

element whose presence in this set is to be tested

Returns:boolean

true if this set contains the specified element

Annotations
@Override
containsAllback to summary
public boolean containsAll(Collection<?> targets)

Overrides java.util.AbstractCollection.containsAll.

Implements java.util.Set.containsAll, java.util.Collection.containsAll.

Doc from java.util.Set.containsAll.

Returns true if this set contains all of the elements of the specified collection. If the specified collection is also a set, this method returns true if it is a subset of this set.

Parameters
targets:Collection<?>

collection to be checked for containment in this set

Returns:boolean

true if this set contains all of the elements of the specified collection

Annotations
@Override
createAsListback to summary
pack-priv ImmutableList<C> createAsList()

Overrides com.google.common.collect.ImmutableSet.CachingAsList.createAsList.

Annotations
@Override
descendingIteratorback to summary
public UnmodifiableIterator<C> descendingIterator()

Implements abstract com.google.common.collect.ImmutableSortedSet.descendingIterator.

Implements java.util.NavigableSet.descendingIterator.

Doc from java.util.NavigableSet.descendingIterator.

Returns an iterator over the elements in this set, in descending order. Equivalent in effect to descendingSet().iterator().

Returns:UnmodifiableIterator<C>

an iterator over the elements in this set, in descending order

Annotations
@GwtIncompatible
@Override
equalsback to summary
public boolean equals(Object object)

Overrides com.google.common.collect.ImmutableSet.equals.

Implements java.util.Set.equals, java.util.Collection.equals.

Doc from java.util.Set.equals.

Compares the specified object with this set for equality. Returns true if the specified object is also a set, the two sets have the same size, and every member of the specified set is contained in this set (or equivalently, every member of this set is contained in the specified set). This definition ensures that the equals method works properly across different implementations of the set interface.

Parameters
object:Object

object to be compared for equality with this set

Returns:boolean

true if the specified object is equal to this set

Annotations
@Override
equalsOrThrowback to summary
private static boolean equalsOrThrow(Comparable<?> left, Comparable<?> right)
firstback to summary
public C first()

Overrides com.google.common.collect.ImmutableSortedSet.first.

Implements java.util.SortedSet.first.

Doc from java.util.SortedSet.first.

Returns the first (lowest) element currently in this set.

Returns:C

the first (lowest) element currently in this set

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides com.google.common.collect.ImmutableSet.hashCode.

Implements java.util.Set.hashCode, java.util.Collection.hashCode.

Doc from java.util.Set.hashCode.

Returns the hash code value for this set. The hash code of a set is defined to be the sum of the hash codes of the elements in the set, where the hash code of a null element is defined to be zero. This ensures that s1.equals(s2) implies that s1.hashCode()==s2.hashCode() for any two sets s1 and s2, as required by the general contract of Object#hashCode.

Returns:int

the hash code value for this set

Annotations
@Override
headSetImplback to summary
pack-priv ContiguousSet<C> headSetImpl(C toElement, boolean inclusive)

Implements abstract com.google.common.collect.ContiguousSet.headSetImpl.

Annotations
@Override
indexOfback to summary
pack-priv int indexOf(Object target)

Implements abstract com.google.common.collect.ImmutableSortedSet.indexOf.

Doc from com.google.common.collect.ImmutableSortedSet.indexOf.

Returns the position of an element within the set, or -1 if not present.

Annotations
@GwtIncompatible
@Override
intersectionback to summary
public ContiguousSet<C> intersection(ContiguousSet<C> other)

Implements abstract com.google.common.collect.ContiguousSet.intersection.

Doc from com.google.common.collect.ContiguousSet.intersection.

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 for ContiguousSet instances.

Annotations
@Override
@SuppressWarnings:unchecked
intersectionInCurrentDomainback to summary
private ContiguousSet<C> intersectionInCurrentDomain(Range<C> other)
isEmptyback to summary
public boolean isEmpty()

Overrides java.util.AbstractCollection.isEmpty.

Implements java.util.Set.isEmpty, java.util.Collection.isEmpty.

Doc from java.util.Set.isEmpty.

Returns true if this set contains no elements.

Returns:boolean

true if this set contains no elements

Annotations
@Override
isPartialViewback to summary
pack-priv boolean isPartialView()

Implements abstract com.google.common.collect.ImmutableCollection.isPartialView.

Doc from com.google.common.collect.ImmutableCollection.isPartialView.

Returns 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.

Annotations
@Override
iteratorback to summary
public UnmodifiableIterator<C> iterator()

Implements abstract com.google.common.collect.ImmutableSortedSet.iterator.

Implements java.util.NavigableSet.iterator, com.google.common.collect.SortedIterable.iterator, java.util.Set.iterator, java.util.Collection.iterator.

Doc from java.util.NavigableSet.iterator.

Returns an iterator over the elements in this set, in ascending order.

Returns:UnmodifiableIterator<C>

an iterator over the elements in this set, in ascending order

Annotations
@Override
lastback to summary
public C last()

Overrides com.google.common.collect.ImmutableSortedSet.last.

Implements java.util.SortedSet.last.

Doc from java.util.SortedSet.last.

Returns the last (highest) element currently in this set.

Returns:C

the last (highest) element currently in this set

Annotations
@Override
rangeback to summary
public Range<C> range()

Implements abstract com.google.common.collect.ContiguousSet.range.

Doc from com.google.common.collect.ContiguousSet.range.

Returns a range, closed on both ends, whose endpoints are the minimum and maximum values contained in this set. This is equivalent to range(CLOSED, CLOSED).

Annotations
@Override
rangeback to summary
public Range<C> range(BoundType lowerBoundType, BoundType upperBoundType)

Implements abstract com.google.common.collect.ContiguousSet.range.

Doc from com.google.common.collect.ContiguousSet.range.

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, if set was created from the range [1..Integer.MAX_VALUE] then set.range(CLOSED, OPEN) must return [1..∞).

Annotations
@Override
readObjectback to summary
private void readObject(ObjectInputStream stream) throws InvalidObjectException

Hides com.google.common.collect.ImmutableSortedSet.readObject.

Annotations
@GwtIncompatible
@J2ktIncompatible
sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Doc from java.util.Set.size.

Returns the number of elements in this set (its cardinality). If this set contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this set (its cardinality)

Annotations
@Override
subSetImplback to summary
pack-priv ContiguousSet<C> subSetImpl(C fromElement, boolean fromInclusive, C toElement, boolean toInclusive)

Implements abstract com.google.common.collect.ContiguousSet.subSetImpl.

Annotations
@Override
@SuppressWarnings:unchecked
tailSetImplback to summary
pack-priv ContiguousSet<C> tailSetImpl(C fromElement, boolean inclusive)

Implements abstract com.google.common.collect.ContiguousSet.tailSetImpl.

Annotations
@Override
writeReplaceback to summary
pack-priv Object writeReplace()

Overrides com.google.common.collect.ContiguousSet.writeReplace.

Annotations
@GwtIncompatible
@J2ktIncompatible
@Override
com.google.common.collect back to summary

private final Class RegularContiguousSet.SerializedForm<C extends Comparable<T>>

extends Object
implements Serializable
Class Inheritance
  • java.lang.Object
  • com.google.common.collect.RegularContiguousSet.SerializedForm
All Implemented Interfaces
java.io.Serializable
Annotations
@GwtIncompatible
@J2ktIncompatible

Field Summary

Modifier and TypeField and Description
pack-priv final DiscreteDomain<C>
pack-priv final Range<C>

Constructor Summary

AccessConstructor and Description
private
SerializedForm(Range<C> range, DiscreteDomain<C> domain)

Method Summary

Modifier and TypeMethod and Description
private Object
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

domainback to summary
pack-priv final DiscreteDomain<C> domain
rangeback to summary
pack-priv final Range<C> range

Constructor Detail

SerializedFormback to summary
private SerializedForm(Range<C> range, DiscreteDomain<C> domain)

Method Detail

readResolveback to summary
private Object readResolve()