public class CacheList extends AbstractList
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 implement the neo.util.cache.CacheObject interface.
This list is not synchronized.
modCount
Constructor and Description |
---|
CacheList()
Empty constructor.
|
CacheList(CacheManager cache,
String cacheType)
Initialize this list with a CacheManager and a cache type.
|
CacheList(CacheManager cache,
String cacheType,
CacheObject[] list)
Initialize this list with a CacheManager and a cache type.
|
CacheList(CacheManager cache,
String cacheType,
int[] list)
Initialize this list with a CacheManager and a cache type.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int i,
Object o)
Add a new object at the specified index.
|
Object |
get(int i)
Get the nth object referred to from the list.
|
int |
indexOf(Object o) |
int |
lastIndexOf(Object o) |
Object |
remove(int i)
Remove an object from the list.
|
void |
removeRange(int from,
int to)
Removes a range of objects.
|
Object |
set(int i,
Object o)
Set a reference.
|
int |
size()
Returns the current size of the list.
|
List |
subList(int from,
int to) |
add, addAll, clear, equals, hashCode, iterator, listIterator, listIterator
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
parallelStream, removeIf, stream
public CacheList()
public CacheList(CacheManager cache, String cacheType)
cache
- The manager to get the actual cached objects from.cacheType
- The type of this cache.CacheManager
public CacheList(CacheManager cache, String cacheType, CacheObject[] list)
cache
- The manager to get the actual cached objects from.cacheType
- The type of this cache.list
- An array of objects to store a reference to.CacheManager
,
CacheObject
public CacheList(CacheManager cache, String cacheType, int[] list)
cache
- The manager to get the actual cached objects from.cacheType
- The type of this cache.list
- An array of objects to store a reference to.CacheManager
,
CacheObject
public int size()
size
in interface Collection
size
in interface List
size
in class AbstractCollection
public Object get(int i) throws IndexOutOfBoundsException
get
in interface List
get
in class AbstractList
i
- The index of the object to get.IndexOutOfBoundsException
- if i < 0 || i >= size().public Object set(int i, Object o) throws IndexOutOfBoundsException, ClassCastException
set
in interface List
set
in class AbstractList
i
- The index of the object to set.IndexOutOfBoundsException
- if i < 0 || i >= size().ClassCastException
- if o is not of the type CacheObject.public 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 list.o
- 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 CacheObject.public Object remove(int i) throws IndexOutOfBoundsException
remove
in interface List
remove
in class AbstractList
The
- index of the object to remove.IndexOutOfBoundsException
- 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 List subList(int from, int to)
subList
in interface List
subList
in class AbstractList
public int indexOf(Object o)
indexOf
in interface List
indexOf
in class AbstractList
public int lastIndexOf(Object o)
lastIndexOf
in interface List
lastIndexOf
in class AbstractList
© 1998- 2018 Stibo DX