public class ObjectArray<E> extends AbstractPrimitiveArray<E[],E>
Object
elements. Note that this class
is a PrimitiveArray
but of course Objects are not primitives.
However, this class still facilitates improved conversion of Object array
types to collections, and thus remains useful (if not completely accurately
congruent with its type hierarchy).
This class still provides a convenient way to work around
Arrays.asList(Object...)
creating a list with a single element. It
also contains improved performance implementations of many Collection
methods.
modCount
Constructor and Description |
---|
ObjectArray(Class<E> arrayType)
Constructs an extensible array of objects, backed by a fixed-size array.
|
ObjectArray(Class<E> arrayType,
int size)
Constructs an extensible array of objects, backed by a fixed-size array.
|
ObjectArray(E[] array)
Constructs an extensible array of objects, backed by the given fixed-size
array.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
E element) |
boolean |
addAll(int index,
Collection<? extends E> c) |
void |
addValue(E value) |
void |
addValue(int index,
E value) |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
E |
defaultValue() |
E |
get(int index) |
E[] |
getArray()
Gets the fixed-size array backing this instance.
|
E |
getValue(int index) |
int |
indexOf(Object o) |
int |
lastIndexOf(Object o) |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
removeValue(E value) |
E |
set(int index,
E element) |
void |
setArray(E[] array)
Sets the fixed-size array backing this instance.
|
E |
setValue(int index,
E value) |
capacity, checkBounds, clear, copyArray, delete, ensureCapacity, getMaximumGrowth, insert, remove, setMaximumGrowth, setSize, size
add, equals, hashCode, iterator, listIterator, listIterator, removeRange, subList
addAll, isEmpty, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, addAll, equals, hashCode, isEmpty, iterator, listIterator, listIterator, replaceAll, retainAll, sort, spliterator, subList, toArray, toArray
parallelStream, removeIf, stream
public ObjectArray(Class<E> arrayType)
public ObjectArray(Class<E> arrayType, int size)
size
- the initial sizepublic ObjectArray(E[] array)
array
- the array to wrappublic void addValue(E value)
public boolean removeValue(E value)
public E getValue(int index)
public void addValue(int index, E value)
public E[] getArray()
PrimitiveArray
public void setArray(E[] array)
PrimitiveArray
array
- the new backing arraypublic E get(int index)
public void add(int index, E element)
public int indexOf(Object o)
public int lastIndexOf(Object o)
lastIndexOf
in interface List<E>
lastIndexOf
in class AbstractList<E>
public boolean contains(Object o)
contains
in interface Collection<E>
contains
in interface List<E>
contains
in class AbstractCollection<E>
public boolean remove(Object o)
remove
in interface Collection<E>
remove
in interface List<E>
remove
in class AbstractCollection<E>
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<E>
containsAll
in interface List<E>
containsAll
in class AbstractCollection<E>
public boolean addAll(int index, Collection<? extends E> c)
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<E>
removeAll
in interface List<E>
removeAll
in class AbstractCollection<E>
public E defaultValue()
Copyright © 2015–2022 SciJava. All rights reserved.