Class SmartList<E>

All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>, RandomAccess

public class SmartList<E> extends AbstractList<E> implements RandomAccess
A List which with optimized memory usage for the sizes of 0 and 1, in which cases it does not allocate an array.

The tradeoff is the following: This list is slower than ArrayList but occupies less memory in case of exactly 1 element. Please use it only if your code contains many 1-element lists outside very hot loops.