Class SmartList<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
com.strobel.collections.SmartList<E>
- All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>, SequencedCollection<E>
A
List that is optimised for the sizes of 0 and 1, in which cases no array is allocated.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class AbstractList
addAll, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, removeRange, subListMethods inherited from class AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toStringMethods inherited from interface Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface List
addAll, addFirst, addLast, contains, containsAll, getFirst, getLast, isEmpty, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, spliterator, toArray
-
Field Details
-
_data
-
_size
private int _size
-
-
Constructor Details
-
SmartList
public SmartList() -
SmartList
-
SmartList
-
SmartList
-
-
Method Details
-
get
-
add
- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceList<E>- Overrides:
addin classAbstractList<E>
-
add
-
size
public int size()- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceList<E>- Specified by:
sizein classAbstractCollection<E>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<E>- Specified by:
clearin interfaceList<E>- Overrides:
clearin classAbstractList<E>
-
set
-
remove
-
iterator
-
sort
-
getModificationCount
public int getModificationCount() -
toArray
-
trimToSize
public void trimToSize()Trims the capacity of this list to be the list's current size. An application can use this operation to minimize the storage of a list instance.
-