E - The type of elements in the list.public class UnmodifiableArrayList<E> extends AbstractList<E> implements CheckedCollection<E>, Serializable
UnmodifiableArrayList.wrap(array);
is equivalent to
Collections.unmodifiableList(Arrays.asList(array)));
But this class provides a very slight performance improvement since it uses one less level of
indirection.modCount| Modifier | Constructor and Description |
|---|---|
protected |
UnmodifiableArrayList(E[] array)
Creates a new instance of an array list.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Object object)
Returns
true if this collection contains the specified element. |
E |
get(int index)
Returns the element at the specified index.
|
Class<E> |
getElementType()
Returns the element type of the wrapped array.
|
int |
indexOf(Object object)
Returns the index in this list of the first occurence of the specified element, or -1 if the
list does not contain this element.
|
int |
lastIndexOf(Object object)
Returns the index in this list of the last occurence of the specified element, or -1 if the
list does not contain this element.
|
int |
size()
Returns the list size.
|
static <E> UnmodifiableArrayList<E> |
wrap(E[] array)
Creates a new instance of an array list.
|
add, add, addAll, clear, equals, hashCode, iterator, listIterator, listIterator, remove, removeRange, set, subListaddAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringadd, addAll, clear, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArrayaddAll, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArrayprotected UnmodifiableArrayList(E[] array)
This constructor is for subclassing only. Users should invoke the wrap(E[]) static
factory method, which provides more convenient handling of parameterized types.
array - The array to wrap.public static <E> UnmodifiableArrayList<E> wrap(E[] array)
E - The type of elements in the list.array - The array to wrap.public Class<E> getElementType()
getElementType in interface CheckedCollection<E>public int size()
size in interface Collection<E>size in interface List<E>size in class AbstractCollection<E>public E get(int index)
public int indexOf(Object object)
public int lastIndexOf(Object object)
lastIndexOf in interface List<E>lastIndexOf in class AbstractList<E>object - The element to searcch for.public boolean contains(Object object)
true if this collection contains the specified element. This method is
overridden only for performance reason (the default implementation would work as well).contains in interface Collection<E>contains in interface List<E>contains in class AbstractCollection<E>object - The element to check for existence.Copyright © 1996–2019 Geotools. All rights reserved.