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>
public class SparseArray<V> extends AbstractSparseArray<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. SeeSafeLongArray
,ReadHeavyLongArray
, andCopyOnWriteLongArray
for thread-safe LongArray implementations.- Author:
- cp 2007.10.08
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
SparseArray.ObjectNode<V>
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
Constructors Constructor Description SparseArray()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SparseArray<V>
clone()
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
-
-
-
-
Method Detail
-
instantiateNode
protected AbstractSparseArray.Node<V> instantiateNode(long lKey, V oValue)
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
public SparseArray<V> clone()
Description copied from class:AbstractSparseArray
Make a clone of the LongArray. The element values are not deep-cloned.
-
-