E - generic typeto be used in this listpublic class WeakList<E>
extends java.util.AbstractList<E>
| Constructor | Description |
|---|---|
WeakList() |
Create a weak random-access list.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
add(int index,
E element) |
Inserts the object at the specified position in the list.
|
E |
get(int index) |
|
java.util.List<E> |
hardList() |
|
E |
remove(int index) |
Removes the object at the specified position and returns it
or returns null if it was already collected.
|
E |
set(int index,
E element) |
Sets the object at the specified position and returns the
previous object at that position or null if it was already
collected.
|
int |
size() |
|
void |
trimToSize() |
Compacts the list by removing references to collected
objects.
|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringadd, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subListpublic E get(int index)
get in class java.util.AbstractList<E>index - of field to getpublic int size()
size in class java.util.AbstractCollection<E>public E set(int index, E element)
set in class java.util.AbstractList<E>index - position where to place elementelement - data which to put on positionpublic void add(int index,
E element)
add in class java.util.AbstractList<E>index - position where to insert elementelement - data which to put on positionpublic E remove(int index)
remove in class java.util.AbstractList<E>index - of element to be removedpublic java.util.List<E> hardList()
public void trimToSize()