zinger.util
Class HashList
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractList
|
+--zinger.util.HashList
- All Implemented Interfaces:
- java.util.Collection, java.util.List
- public class HashList
- extends java.util.AbstractList
A list that caches object-to-index mappings. Works as a proxy to another list object.
Field Summary |
protected java.util.Map |
indexMap
|
protected boolean |
notLazy
|
protected java.util.List |
source
The list object that provides core list functionality. |
Fields inherited from class java.util.AbstractList |
modCount |
Constructor Summary |
HashList()
Calls HashList(true) . |
HashList(boolean lazy)
Calls HashList(new ArrayList(), updateIndexMapOnChanges) . |
HashList(java.util.List source,
boolean lazy)
|
Method Summary |
void |
add(int index,
java.lang.Object obj)
|
java.lang.Object |
get(int index)
|
int |
indexOf(java.lang.Object obj)
|
java.lang.Object |
remove(int index)
|
java.lang.Object |
set(int index,
java.lang.Object obj)
|
int |
size()
|
private void |
updateIndexMap(java.lang.Object obj,
int index)
|
Methods inherited from class java.util.AbstractList |
add, addAll, clear, equals, hashCode, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList |
Methods inherited from class java.util.AbstractCollection |
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
, clone, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait |
Methods inherited from interface java.util.List |
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
source
protected final java.util.List source
- The list object that provides core list functionality. Can be specified by the user.
indexMap
protected final java.util.Map indexMap
notLazy
protected final boolean notLazy
HashList
public HashList(java.util.List source,
boolean lazy)
- Parameters:
source
- specifies the list object to be used for storage. It can already
contain data. This is not a constructor that copies the contents of the original
collection into the new instance.lazy
- whether or not we'll be precaching object-to-index mappings
HashList
public HashList(boolean lazy)
- Calls
HashList(new ArrayList(), updateIndexMapOnChanges)
.
- See Also:
HashList(java.util.List, boolean)
HashList
public HashList()
- Calls
HashList(true)
.
- See Also:
HashList(boolean)
get
public java.lang.Object get(int index)
throws java.lang.IndexOutOfBoundsException
- Overrides:
get
in class java.util.AbstractList
size
public int size()
- Overrides:
size
in class java.util.AbstractCollection
set
public java.lang.Object set(int index,
java.lang.Object obj)
throws java.lang.UnsupportedOperationException,
java.lang.ClassCastException,
java.lang.IllegalArgumentException,
java.lang.IndexOutOfBoundsException
- Overrides:
set
in class java.util.AbstractList
add
public void add(int index,
java.lang.Object obj)
throws java.lang.UnsupportedOperationException,
java.lang.ClassCastException,
java.lang.IllegalArgumentException,
java.lang.IndexOutOfBoundsException
- Overrides:
add
in class java.util.AbstractList
remove
public java.lang.Object remove(int index)
throws java.lang.UnsupportedOperationException,
java.lang.IndexOutOfBoundsException
- Overrides:
remove
in class java.util.AbstractList
indexOf
public int indexOf(java.lang.Object obj)
- Overrides:
indexOf
in class java.util.AbstractList
updateIndexMap
private void updateIndexMap(java.lang.Object obj,
int index)