public class UnsafeArrayList<T> extends AbstractList<T> implements InplaceList<T>, RandomAccess
This is not thread safe.
modCount
Constructor and Description |
---|
UnsafeArrayList(Class<T> type) |
UnsafeArrayList(Class<T> type,
Collection<? extends T> c) |
UnsafeArrayList(Class<T> type,
int initialCapacity) |
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
T element) |
long |
bytes() |
protected void |
checkBounds(int index) |
void |
ensureCapacity(int capacity) |
T |
get(int index) |
T |
get(T dest,
int index)
Copies the element at index into dest
|
T |
set(int index,
T element) |
int |
size() |
void |
swap(int i,
int j)
Swaps two elements
|
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, sort, spliterator, subList, toArray, toArray
parallelStream, removeIf, stream
public UnsafeArrayList(Class<T> type)
type
- Must match the parameterised typepublic UnsafeArrayList(Class<T> type, Collection<? extends T> c)
public void ensureCapacity(int capacity)
protected void checkBounds(int index) throws IndexOutOfBoundsException
IndexOutOfBoundsException
public T get(int index)
public T get(T dest, int index)
get
in interface InplaceList<T>
dest
- The destination objectindex
- The index of the object to getpublic void swap(int i, int j)
swap
in interface InplaceList<T>
i
- Index of first elementj
- Index of second elementpublic void add(int index, T element)
public int size()
size
in interface Collection<T>
size
in interface List<T>
size
in class AbstractCollection<T>
public long bytes()
Copyright © 2015. All rights reserved.