@GwtCompatible(serializable=true, emulated=true) final class SingletonImmutableList<E> extends ImmutableList<E>
ImmutableList with exactly one element.ImmutableList.Builder<E>, ImmutableList.SerializedForm, ImmutableList.SubListImmutableCollection.ArrayBasedBuilder<E>| Constructor and Description |
|---|
SingletonImmutableList(E element) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(java.lang.Object object) |
(package private) int |
copyIntoArray(java.lang.Object[] dst,
int offset)
Copies the contents of this immutable collection into the specified array at the specified
offset.
|
boolean |
equals(java.lang.Object object) |
E |
get(int index) |
int |
hashCode() |
int |
indexOf(java.lang.Object object) |
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<E> |
iterator()
Returns an unmodifiable iterator across the elements in this collection.
|
int |
lastIndexOf(java.lang.Object object) |
ImmutableList<E> |
reverse()
Returns a view of this immutable list in reverse order.
|
int |
size() |
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, copyOf, copyOf, copyOf, copyOf, listIterator, listIterator, of, of, of, of, of, of, of, of, of, of, of, of, of, remove, set, subListUnchecked, writeReplaceadd, addAll, clear, createAsList, remove, removeAll, retainAll, toArray, toArrayclone, finalize, getClass, notify, notifyAll, wait, wait, waitfinal transient E element
SingletonImmutableList(E element)
public E get(int index)
public int indexOf(@Nullable
java.lang.Object object)
indexOf in interface java.util.List<E>indexOf in class ImmutableList<E>public UnmodifiableIterator<E> iterator()
ImmutableCollectionpublic int lastIndexOf(@Nullable
java.lang.Object object)
lastIndexOf in interface java.util.List<E>lastIndexOf in class ImmutableList<E>public int size()
public ImmutableList<E> subList(int fromIndex, int toIndex)
ImmutableListfromIndex, 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 ImmutableList<E> reverse()
ImmutableListImmutableList.of(1, 2, 3).reverse() is equivalent to ImmutableList.of(3, 2, 1).reverse in class ImmutableList<E>public boolean contains(@Nullable
java.lang.Object object)
contains in interface java.util.Collection<E>contains in interface java.util.List<E>contains in class ImmutableList<E>public boolean equals(@Nullable
java.lang.Object object)
equals in interface java.util.Collection<E>equals in interface java.util.List<E>equals in class ImmutableList<E>public int hashCode()
hashCode in interface java.util.Collection<E>hashCode in interface java.util.List<E>hashCode in class ImmutableList<E>public java.lang.String toString()
toString in class java.util.AbstractCollection<E>public boolean isEmpty()
boolean isPartialView()
ImmutableCollectiontrue 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>int copyIntoArray(java.lang.Object[] dst,
int offset)
ImmutableCollectionoffset + size().copyIntoArray in class ImmutableList<E>