Package com.tangosol.util
Class SparseArray<V>
java.lang.Object
com.tangosol.util.AbstractLongArray<V>
com.tangosol.util.AbstractSparseArray<V>
com.tangosol.util.SparseArray<V>
- All Implemented Interfaces:
LongArray<V>,Serializable,Cloneable,Iterable<V>
A data structure resembling an Object array indexed by long values.
This data structure is not thread safe and if there exists the possibility that some thread may perform
a mutation while other thread(s) are reading/iterating then some form of locking is required to protect
the SparseArray. Note that concurrent readers are allowed, thus protecting the SparseArray with a
read-write would be appropriate. See
SafeLongArray, ReadHeavyLongArray, and
CopyOnWriteLongArray for thread-safe LongArray implementations.- Author:
- cp 2007.10.08
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classNode mapping long key to Object value.Nested classes/interfaces inherited from class com.tangosol.util.AbstractSparseArray
AbstractSparseArray.Crawler, AbstractSparseArray.Node<V>Nested classes/interfaces inherited from interface com.tangosol.util.LongArray
LongArray.Iterator<V> -
Field Summary
Fields inherited from class com.tangosol.util.AbstractSparseArray
m_head, m_size -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Make a clone of the LongArray.protected AbstractSparseArray.Node<V>instantiateNode(long lKey, V oValue) Factory pattern: create a new Node with the specified key and value.Methods inherited from class com.tangosol.util.AbstractSparseArray
adjustDoubleBalance, balancedInsertion, balancePostRemove, ceiling, ceilingIndex, clear, doubleRotate, exists, find, findInsertionPoint, floor, floorIndex, get, getFirstIndex, getLastIndex, getSize, instantiateCrawler, iterator, iterator, print, remove, remove, remove, replace, reverseIterator, reverseIterator, rotate, set, validateMethods inherited from class com.tangosol.util.AbstractLongArray
add, contains, equals, hashCode, indexOf, indexOf, isEmpty, lastIndexOf, lastIndexOf, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
SparseArray
public SparseArray()
-
-
Method Details
-
instantiateNode
Factory pattern: create a new Node with the specified key and value.- Specified by:
instantiateNodein classAbstractSparseArray<V>- Parameters:
lKey- the long keyoValue- the object value- Returns:
- the new node
-
clone
Description copied from class:AbstractSparseArrayMake a clone of the LongArray. The element values are not deep-cloned.
-