public class WeakList
extends java.util.AbstractList
| Constructor and Description |
|---|
WeakList()
Create a weak random-access list.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
java.lang.Object element)
Inserts the object at the specified position in the list.
|
java.lang.Object |
get(int index)
Returns the object at the specified index, or null if the
object has been collected.
|
java.util.List |
hardList()
Returns a list of hard references to the objects.
|
java.lang.Object |
remove(int index)
Removes the object at the specified position and returns it
or returns null if it was already collected.
|
java.lang.Object |
set(int index,
java.lang.Object 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()
Returns the size of the list, including already collected
objects.
|
void |
trimToSize()
Compacts the list by removing references to collected
objects.
|
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringpublic java.lang.Object get(int index)
get in interface java.util.Listget in class java.util.AbstractListpublic int size()
size in interface java.util.Collectionsize in interface java.util.Listsize in class java.util.AbstractCollectionpublic java.lang.Object set(int index,
java.lang.Object element)
set in interface java.util.Listset in class java.util.AbstractListpublic void add(int index,
java.lang.Object element)
add in interface java.util.Listadd in class java.util.AbstractListpublic java.lang.Object remove(int index)
remove in interface java.util.Listremove in class java.util.AbstractListpublic java.util.List hardList()
public void trimToSize()