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
Modifier and TypeClassDescriptionprotected static class
Node 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
-
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, validate
Methods inherited from class com.tangosol.util.AbstractLongArray
add, contains, equals, hashCode, indexOf, indexOf, isEmpty, lastIndexOf, lastIndexOf, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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:
instantiateNode
in classAbstractSparseArray<V>
- Parameters:
lKey
- the long keyoValue
- the object value- Returns:
- the new node
-
clone
Description copied from class:AbstractSparseArray
Make a clone of the LongArray. The element values are not deep-cloned.
-