public class CacheList extends AbstractList
IOObjectLoader
. Only IOHashKey's
will be stored
in this list, the actually objects will be fetched from the ObjectLoader
by using the
ObjectLoader.getObject(IOHashKey) method call.
This implementation of AbstractList
uses an array to store the values. The initial size is set
to 20. When the number of items is greater than this, the size of the list will be doubled.
The objects referred to by this list have to be IOObjects
interface.
This list is not synchronized.
modCount
Constructor and Description |
---|
CacheList()
Deprecated.
Empty constructor.
|
CacheList(Collection list)
Deprecated.
Initializes the list with the given collection.
|
CacheList(IOHashKey[] list)
Deprecated.
Initializes the list with the given array.
|
CacheList(IOObject[] list)
Deprecated.
Initializes the list with the given array.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int i,
Object o)
Deprecated.
Adds a new object at the specified index.
|
Object |
get(int i)
Deprecated.
Retrieves the nth object referred to from the list.
|
Iterator |
iterator()
Deprecated.
|
Object |
remove(int i)
Deprecated.
Removes an object from the list.
|
void |
removeRange(int from,
int to)
Deprecated.
Removes a range of objects.
|
Object |
set(int i,
Object o)
Deprecated.
Adds a new reference.
|
int |
size()
Deprecated.
Returns the current size of the list.
|
Object[] |
toArray(Object[] a)
Deprecated.
|
add, addAll, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray
parallelStream, removeIf, stream
public CacheList()
public CacheList(IOObject[] list)
list
- an array of IOObjects
to store a reference to.public CacheList(Collection list)
list
- a Collection
of objects to store a reference to.public CacheList(IOHashKey[] list)
list
- an array of objects to store a reference to.public int size()
size
in interface Collection
size
in interface List
size
in class AbstractCollection
public Object get(int i) throws IndexOutOfBoundsException, NoSuchObjectException
get
in interface List
get
in class AbstractList
i
- the index of the object to retrieveIndexOutOfBoundsException
- if i < 0 || i >= size()NoSuchObjectException
- if the element is deleted from the systempublic Object set(int i, Object o) throws IndexOutOfBoundsException, ClassCastException
set
in interface List
set
in class AbstractList
i
- the index of the new referenceIndexOutOfBoundsException
- if i < 0 || i >= size()ClassCastException
- if o is not of the type CacheObjectpublic void add(int i, Object o) throws IndexOutOfBoundsException, ClassCastException
add
in interface List
add
in class AbstractList
i
- where to place the new object in the listo
- the object to store. Will only store the id of the object. The actual object will
be fetched when needed.IndexOutOfBoundsException
- if i < 0 || i > size()ClassCastException
- if o is not of the type CacheObjectpublic Object remove(int i) throws IndexOutOfBoundsException
remove
in interface List
remove
in class AbstractList
i
- index of the object to removeIndexOutOfBoundsException
- if i < 0 || i >= size()public void removeRange(int from, int to) throws IndexOutOfBoundsException
removeRange
in class AbstractList
from
- remove objects from this index (included)to
- remove objects to this index (excluded)IndexOutOfBoundsException
- from < 0 || from >= size() or to < 0 || to >= size()public Iterator iterator()
iterator
in interface Iterable
iterator
in interface Collection
iterator
in interface List
iterator
in class AbstractList
public Object[] toArray(Object[] a)
toArray
in interface Collection
toArray
in interface List
toArray
in class AbstractCollection
© 1998- 2018 Stibo DX