E - element typepublic class ChunkList<E> extends AbstractSequentialList<E>
LinkedList, but stores elements
in chunks of 32 elements.
ArrayList has O(n) insertion and deletion into the middle of the list. ChunkList insertion and deletion are O(1).
| Modifier and Type | Class and Description |
|---|---|
private class |
ChunkList.ChunkListIterator
Iterator over a
ChunkList. |
| Modifier and Type | Field and Description |
|---|---|
private static int |
CHUNK_SIZE |
private Object[] |
first |
private static int |
HEADER_SIZE |
private static Integer[] |
INTEGERS |
private Object[] |
last |
private int |
size |
modCount| Constructor and Description |
|---|
ChunkList()
Creates an empty ChunkList.
|
ChunkList(Collection<E> collection)
Creates a ChunkList whose contents are a given Collection.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E element) |
void |
add(int index,
E element) |
void |
clear() |
private static Object |
element(Object[] chunk,
int index) |
(package private) boolean |
isValid(boolean fail)
For debugging and testing.
|
ListIterator<E> |
listIterator(int index) |
private ChunkList.ChunkListIterator |
locate(int index) |
private static Object[] |
next(Object[] chunk) |
private static int |
occupied(Object[] chunk) |
private static Object[] |
prev(Object[] chunk) |
private static void |
setElement(Object[] chunk,
int index,
Object element) |
private static void |
setNext(Object[] chunk,
Object[] next) |
private static void |
setOccupied(Object[] chunk,
int size) |
private static void |
setPrev(Object[] chunk,
Object[] prev) |
int |
size() |
equals, hashCode, indexOf, lastIndexOf, listIterator, removeRange, 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 static final int HEADER_SIZE
private static final int CHUNK_SIZE
private static final Integer[] INTEGERS
private int size
private Object[] first
private Object[] last
public ChunkList()
public ChunkList(Collection<E> collection)
boolean isValid(boolean fail)
public ListIterator<E> listIterator(int index)
listIterator in interface List<E>listIterator in class AbstractSequentialList<E>public int size()
size in interface Collection<E>size in interface List<E>size in class AbstractCollection<E>public void clear()
clear in interface Collection<E>clear in interface List<E>clear in class AbstractList<E>public boolean add(E element)
add in interface Collection<E>add in interface List<E>add in class AbstractList<E>public void add(int index,
E element)
private static int occupied(Object[] chunk)
private static void setOccupied(Object[] chunk, int size)
private ChunkList.ChunkListIterator locate(int index)
Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.