public class CachedList extends AbstractList
List which translates added objects
into SoftObject references, allowing the VM to garbage collect
objects in the collection when memory is low.| Modifier and Type | Field and Description |
|---|---|
protected List |
list
Wrapped list.
|
protected ReferenceQueue |
queue
Reference queue.
|
modCount| Constructor and Description |
|---|
CachedList()
Construct a CachedList using a LinkedList for
storage.
|
CachedList(List list)
Construct a CachedList.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
Object obj)
Inserts the specified element at the specified position in this list
(optional operation).
|
Object |
get(int index)
Returns the element at the specified position in this list.
|
Object |
remove(int index)
Removes the element at the specified position in this list (optional
operation).
|
Object |
set(int index,
Object obj)
Replaces the element at the specified position in this list with the
specified element.
|
int |
size()
Return the size of the list.
|
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringprotected final ReferenceQueue queue
protected final List list
public CachedList(List list)
list - List to wrap.public CachedList()
public Object get(int index)
get in interface Listget in class AbstractListindex - Index of element to return.public int size()
size in interface Collectionsize in interface Listsize in class AbstractCollectionpublic Object set(int index, Object obj)
set in interface Listset in class AbstractListindex - Index of element to replace.obj - Element to be stored at the specified postion.public void add(int index,
Object obj)
add in interface Listadd in class AbstractListindex - Index at which the specified element is to be inserted.obj - Element to be inserted.public Object remove(int index)
remove in interface Listremove in class AbstractListindex - The index of the element to remove.Copyright © 2015 JBoss by Red Hat. All rights reserved.