E
- generic typeto be used in this listjava.lang.Iterable<E>
, java.util.Collection<E>
, java.util.List<E>
public 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, toString
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
public E get(int index)
public int size()
public E set(int index, E element)
public void add(int index, E element)
public E remove(int index)
public java.util.List<E> hardList()
public void trimToSize()