Attic
CollectionsLists

Overview

Ordered, index-based collections with comparison benchmarks and structural trade-offs

The List<E> interface represents an ordered sequence of elements where duplicates and null values are allowed. Elements can be inserted or accessed by their integer index.


List Implementations Comparison

ClassInternal StructureAccess (get(i))Append (add)Head Insert/DeleteThread Safe
ArrayListContiguous dynamic arrayO(1)O(1) amortizedO(n)No
LinkedListDoubly-linked discrete nodesO(n)O(1)O(1)No
VectorSynchronized dynamic arrayO(1)O(1) amortizedO(n)Yes (Locking)
StackExtends Vector (LIFO)O(1)O(1)O(1) (top)Yes (Locking)

Detailed Guides

On this page