Package com.strobel.collections
Class SmartList<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- com.strobel.collections.SmartList<E>
-
- All Implemented Interfaces:
java.lang.Iterable<E>,java.util.Collection<E>,java.util.List<E>
public class SmartList<E> extends java.util.AbstractList<E>AListthat is optimised for the sizes of 0 and 1, in which cases no array is allocated.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classSmartList.SingletonIterator
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, E e)booleanadd(E e)voidclear()Eget(int index)intgetModificationCount()java.util.Iterator<E>iterator()Eremove(int index)Eset(int index, E element)intsize()voidsort(java.util.Comparator<? super E> comparator)<T> T[]toArray(T[] a)voidtrimToSize()Trims the capacity of this list to be the list's current size.-
Methods inherited from class java.util.AbstractList
addAll, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toString
-
-
-
-
Method Detail
-
get
public E get(int index)
-
add
public boolean add(E e)
-
add
public void add(int index, E e)
-
size
public int size()
-
clear
public void clear()
-
remove
public E remove(int index)
-
getModificationCount
public int getModificationCount()
-
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.
-
-