@GwtCompatible(serializable=true, emulated=true) final class SingletonImmutableList<E> extends ImmutableList<E>
ImmutableList
with exactly one element.ImmutableList.Builder<E>, ImmutableList.SerializedForm, ImmutableList.SubList
Modifier and Type | Field and Description |
---|---|
(package private) E |
element |
SPLITERATOR_CHARACTERISTICS
Constructor and Description |
---|
SingletonImmutableList(E element) |
Modifier and Type | Method and Description |
---|---|
E |
get(int index) |
(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<E> |
iterator()
Returns an unmodifiable iterator across the elements in this collection.
|
int |
size() |
java.util.Spliterator<E> |
spliterator() |
ImmutableList<E> |
subList(int fromIndex,
int toIndex)
Returns an immutable list of the elements between the specified
fromIndex , inclusive,
and toIndex , exclusive. |
java.lang.String |
toString() |
add, addAll, asImmutableList, asImmutableList, asList, builder, builderWithExpectedSize, contains, copyIntoArray, copyOf, copyOf, copyOf, copyOf, equals, forEach, hashCode, indexOf, lastIndexOf, listIterator, listIterator, of, of, of, of, of, of, of, of, of, of, of, of, of, remove, replaceAll, reverse, set, sort, sortedCopyOf, sortedCopyOf, subListUnchecked, toImmutableList, writeReplace
add, addAll, clear, remove, removeAll, removeIf, retainAll, toArray, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
final transient E element
SingletonImmutableList(E element)
public E get(int index)
public UnmodifiableIterator<E> iterator()
ImmutableCollection
public java.util.Spliterator<E> spliterator()
spliterator
in interface java.lang.Iterable<E>
spliterator
in interface java.util.Collection<E>
spliterator
in interface java.util.List<E>
spliterator
in class ImmutableList<E>
public int size()
public ImmutableList<E> subList(int fromIndex, int toIndex)
ImmutableList
fromIndex
, inclusive,
and toIndex
, exclusive. (If fromIndex
and toIndex
are equal, the empty
immutable list is returned.)subList
in interface java.util.List<E>
subList
in class ImmutableList<E>
public java.lang.String toString()
toString
in class java.util.AbstractCollection<E>
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<E>