public static class VirtualFlow.ArrayLinkedList<T> extends AbstractList<T>
This linked list like implementation is done using an array. It begins by putting the first item in the center of the allocated array, and then grows outward (either towards the first or last of the array depending on whether we are inserting at the head or tail). It maintains an index to the start and end of the array, so that it can efficiently expose iteration.
This class is package private solely for the sake of testing.
modCount
Constructor and Description |
---|
ArrayLinkedList() |
Modifier and Type | Method and Description |
---|---|
void |
addFirst(T cell) |
void |
addLast(T cell) |
void |
clear() |
T |
get(int index) |
T |
getFirst() |
T |
getLast() |
boolean |
isEmpty() |
T |
remove(int index) |
T |
removeFirst() |
T |
removeLast() |
int |
size() |
add, add, addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, set, subList
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, contains, containsAll, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
parallelStream, removeIf, stream
public T getFirst()
public T getLast()
public void addFirst(T cell)
public void addLast(T cell)
public int size()
size
in interface Collection<T>
size
in interface List<T>
size
in class AbstractCollection<T>
public boolean isEmpty()
isEmpty
in interface Collection<T>
isEmpty
in interface List<T>
isEmpty
in class AbstractCollection<T>
public T get(int index)
public void clear()
clear
in interface Collection<T>
clear
in interface List<T>
clear
in class AbstractList<T>
public T removeFirst()
public T removeLast()
Copyright © 2020. All rights reserved.