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

pack-priv final Class RegularImmutableSortedSet<E>

extends ImmutableSortedSet<E>
Class Inheritance
Annotations
@GwtCompatible
serializable:true
emulated:true
@SuppressWarnings:serial, rawtypes
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkNotNull

An immutable sorted set with one or more elements. TODO(jlevy): Consider separate class for a single-element sorted set.
Authors
Jared Levy, Louis Wasserman

Field Summary

Modifier and TypeField and Description
private final transient ImmutableList<E>
pack-priv static final RegularImmutableSortedSet<Comparable<T>>
Inherited from com.google.common.collect.ImmutableSortedSet:
comparatordescendingSetSPLITERATOR_CHARACTERISTICS

Constructor Summary

AccessConstructor and Description
pack-priv
RegularImmutableSortedSet(ImmutableList<E> elements, Comparator<? super E> comparator)

Method Summary

Modifier and TypeMethod and Description
public E
ceiling(E
the value to match
element
)

Overrides com.google.common.collect.ImmutableSortedSet.ceiling.

Implements java.util.NavigableSet.ceiling.

Returns the least element in this set greater than or equal to the given element, or null if there is no such element.
public boolean
contains(Object
element whose presence in this set is to be tested
o
)

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 int
copyIntoArray(@Nullable Object[] dst, int offset)

pack-priv ImmutableList<E>
pack-priv ImmutableSortedSet<E>
public UnmodifiableIterator<E>
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.
public E
first()

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

Implements java.util.SortedSet.first.

Returns the first (lowest) element currently in this set.
public E
floor(E
the value to match
element
)

Overrides com.google.common.collect.ImmutableSortedSet.floor.

Implements java.util.NavigableSet.floor.

Returns the greatest element in this set less than or equal to the given element, or null if there is no such element.
public void
forEach(Consumer<? super E>
The action to be performed for each element
action
)

Overrides default java.lang.Iterable.forEach.

Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception.
pack-priv RegularImmutableSortedSet<E>
getSubSet(int newFromIndex, int newToIndex)

pack-priv int
headIndex(E toElement, boolean inclusive)

pack-priv ImmutableSortedSet<E>
headSetImpl(E toElement, boolean inclusive)

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

public E
higher(E
the value to match
element
)

Overrides com.google.common.collect.ImmutableSortedSet.higher.

Implements java.util.NavigableSet.higher.

Returns the least element in this set strictly greater than the given element, or null if there is no such element.
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.
pack-priv Object[]
internalArray()

Overrides com.google.common.collect.ImmutableCollection.internalArray.

If this collection is backed by an array of its elements in insertion order, returns it.
pack-priv int
internalArrayEnd()

Overrides com.google.common.collect.ImmutableCollection.internalArrayEnd.

If this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements end.
pack-priv int
internalArrayStart()

Overrides com.google.common.collect.ImmutableCollection.internalArrayStart.

If this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements start.
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<E>
public E
last()

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

Implements java.util.SortedSet.last.

Returns the last (highest) element currently in this set.
public E
lower(E
the value to match
element
)

Overrides com.google.common.collect.ImmutableSortedSet.lower.

Implements java.util.NavigableSet.lower.

Returns the greatest element in this set strictly less than the given element, or null if there is no such element.
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).
public Spliterator<E>
pack-priv ImmutableSortedSet<E>
subSetImpl(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)

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

pack-priv int
tailIndex(E fromElement, boolean inclusive)

pack-priv ImmutableSortedSet<E>
tailSetImpl(E fromElement, boolean inclusive)

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

private int
pack-priv Comparator<Object>
Inherited from com.google.common.collect.ImmutableSortedSet:
comparatorconstructcopyOfcopyOfcopyOfcopyOfcopyOfcopyOfcopyOfcopyOfSorteddescendingSetemptySetheadSetheadSetnaturalOrderofofofofofofoforderedBypollFirstpollLastreverseOrdersubSetsubSettailSettailSettoImmutableSortedSetunsafeCompareunsafeComparewriteReplace

Field Detail

elementsback to summary
private final transient ImmutableList<E> elements
NATURAL_EMPTY_SETback to summary
pack-priv static final RegularImmutableSortedSet<Comparable<T>> NATURAL_EMPTY_SET

Constructor Detail

RegularImmutableSortedSetback to summary
pack-priv RegularImmutableSortedSet(ImmutableList<E> elements, Comparator<? super E> comparator)

Method Detail

ceilingback to summary
public E ceiling(E element)

Overrides com.google.common.collect.ImmutableSortedSet.ceiling.

Implements java.util.NavigableSet.ceiling.

Doc from java.util.NavigableSet.ceiling.

Returns the least element in this set greater than or equal to the given element, or null if there is no such element.

Parameters
element:E

the value to match

Returns:E

the least element greater than or equal to e, or null if there is no such element

Annotations
@Override
@CheckForNull
containsback to summary
public boolean contains(Object o)

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
o: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
copyIntoArrayback to summary
pack-priv int copyIntoArray(@Nullable Object[] dst, int offset)
Annotations
@Override
createAsListback to summary
pack-priv ImmutableList<E> createAsList()

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

Annotations
@Override
createDescendingSetback to summary
pack-priv ImmutableSortedSet<E> createDescendingSet()

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

Annotations
@Override
descendingIteratorback to summary
public UnmodifiableIterator<E> 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<E>

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
firstback to summary
public E 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:E

the first (lowest) element currently in this set

Annotations
@Override
floorback to summary
public E floor(E element)

Overrides com.google.common.collect.ImmutableSortedSet.floor.

Implements java.util.NavigableSet.floor.

Doc from java.util.NavigableSet.floor.

Returns the greatest element in this set less than or equal to the given element, or null if there is no such element.

Parameters
element:E

the value to match

Returns:E

the greatest element less than or equal to e, or null if there is no such element

Annotations
@Override
@CheckForNull
forEachback to summary
public void forEach(Consumer<? super E> action)

Overrides default java.lang.Iterable.forEach.

Doc from java.lang.Iterable.forEach.

Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller.

The behavior of this method is unspecified if the action performs side-effects that modify the underlying source of elements, unless an overriding class has specified a concurrent modification policy.

Parameters
action:Consumer<? super E>

The action to be performed for each element

Annotations
@Override
getSubSetback to summary
pack-priv RegularImmutableSortedSet<E> getSubSet(int newFromIndex, int newToIndex)
headIndexback to summary
pack-priv int headIndex(E toElement, boolean inclusive)
headSetImplback to summary
pack-priv ImmutableSortedSet<E> headSetImpl(E toElement, boolean inclusive)

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

Annotations
@Override
higherback to summary
public E higher(E element)

Overrides com.google.common.collect.ImmutableSortedSet.higher.

Implements java.util.NavigableSet.higher.

Doc from java.util.NavigableSet.higher.

Returns the least element in this set strictly greater than the given element, or null if there is no such element.

Parameters
element:E

the value to match

Returns:E

the least element greater than e, or null if there is no such element

Annotations
@Override
@CheckForNull
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
@Override
internalArrayback to summary
pack-priv Object[] internalArray()

Overrides com.google.common.collect.ImmutableCollection.internalArray.

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

If this collection is backed by an array of its elements in insertion order, returns it.

Annotations
@Override
@CheckForNull
internalArrayEndback to summary
pack-priv int internalArrayEnd()

Overrides com.google.common.collect.ImmutableCollection.internalArrayEnd.

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

If this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements end.

Annotations
@Override
internalArrayStartback to summary
pack-priv int internalArrayStart()

Overrides com.google.common.collect.ImmutableCollection.internalArrayStart.

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

If this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements start.

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<E> 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<E>

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

Annotations
@Override
lastback to summary
public E 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:E

the last (highest) element currently in this set

Annotations
@Override
lowerback to summary
public E lower(E element)

Overrides com.google.common.collect.ImmutableSortedSet.lower.

Implements java.util.NavigableSet.lower.

Doc from java.util.NavigableSet.lower.

Returns the greatest element in this set strictly less than the given element, or null if there is no such element.

Parameters
element:E

the value to match

Returns:E

the greatest element less than e, or null if there is no such element

Annotations
@Override
@CheckForNull
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
spliteratorback to summary
public Spliterator<E> spliterator()

Overrides com.google.common.collect.ImmutableSortedSet.spliterator.

Overrides default java.util.SortedSet.spliterator, java.lang.Iterable.spliterator, java.util.Set.spliterator, java.util.Collection.spliterator.

Doc from java.util.SortedSet.spliterator.

Creates a Spliterator over the elements in this sorted set.

The Spliterator reports Spliterator#DISTINCT, Spliterator#SORTED and Spliterator#ORDERED. Implementations should document the reporting of additional characteristic values.

The spliterator's comparator (see java.util.Spliterator#getComparator()) must be null if the sorted set's comparator (see comparator()) is null. Otherwise, the spliterator's comparator must be the same as or impose the same total ordering as the sorted set's comparator.

Returns:Spliterator<E>

a Spliterator over the elements in this sorted set

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

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

Annotations
@Override
tailIndexback to summary
pack-priv int tailIndex(E fromElement, boolean inclusive)
tailSetImplback to summary
pack-priv ImmutableSortedSet<E> tailSetImpl(E fromElement, boolean inclusive)

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

Annotations
@Override
unsafeBinarySearchback to summary
private int unsafeBinarySearch(Object key) throws ClassCastException
unsafeComparatorback to summary
pack-priv Comparator<Object> unsafeComparator()
Annotations
@SuppressWarnings:unchecked