E - Element typepublic class UnmodifiableArrayList<E> extends AbstractList<E> implements RandomAccess
Since the array is not copied, modifications to the array will be reflected in the list.
Null elements are allowed.
Quick and low-memory, like Arrays.asList(Object[]), but
unmodifiable.
| Modifier and Type | Field and Description |
|---|---|
private E[] |
elements |
modCount| Modifier | Constructor and Description |
|---|---|
private |
UnmodifiableArrayList(E[] elements) |
| Modifier and Type | Method and Description |
|---|---|
E |
get(int index) |
static <E> UnmodifiableArrayList<E> |
of(E... elements) |
int |
size() |
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArrayparallelStream, removeIf, streamprivate final E[] elements
private UnmodifiableArrayList(E[] elements)
public static <E> UnmodifiableArrayList<E> of(E... elements)
public E get(int index)
public int size()
size in interface Collection<E>size in interface List<E>size in class AbstractCollection<E>Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.