Skip navigation links
com.tangosol.util
Class CopyOnWriteLongArray
java.lang.Object
com.oracle.common.collections.CopyOnWriteLongArray
com.tangosol.util.CopyOnWriteLongArray
- All Implemented Interfaces:
- com.oracle.common.collections.LongArray, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable
-
public class CopyOnWriteLongArray
- extends com.oracle.common.collections.CopyOnWriteLongArray
- implements LongArray
A thread-safe variant of LongArray
in which all mutating operations (e.g. add, set) are implemented by making a fresh copy of the underlying array.
Iterators over this LongArray are guaranteed to produce a safe-iteration and not to throw ConcurrentModificationException. The iterator will not reflect concurrent additions, removals, or changes to this array. Mutating operations on iterators themselves (e.g. remove, setValue) are not supported (and will throw UnsupportedOperationException).
Note: mutations on this LongArray are costly, but may be more efficient than alternatives when traversal operations vastly outnumber mutations. All mutating operations are synchronized, so concurrent mutation can be prevented by holding synchronization on this object.
- Since:
- Coherence 3.7
- Author:
- rhl 2010.09.09
Fields inherited from class com.oracle.common.collections.CopyOnWriteLongArray |
EMPTY_ARRAY |
Fields inherited from interface com.oracle.common.collections.LongArray |
NOT_FOUND |
Constructor Summary |
CopyOnWriteLongArray()
Default constructor. |
CopyOnWriteLongArray(java.lang.Class clazz)
Construct a CopyOnWriteLongArray with an underlying array of the specified type. |
CopyOnWriteLongArray(com.oracle.common.collections.LongArray array)
Construct a CopyOnWriteLongArray, initialized with the contents of the specified LongArray. |
Methods inherited from class com.oracle.common.collections.CopyOnWriteLongArray |
add, ceiling, ceilingIndex, clear, clone, contains, copyArray, exists, floor, floorIndex, get, getFirstIndex, getInternalArray, getLastIndex, getSize, indexOf, indexOf, isEmpty, lastIndexOf, lastIndexOf, remove, remove, set, setInternalArray |
Methods inherited from interface com.oracle.common.collections.LongArray |
add, ceiling, ceilingIndex, clear, clone, contains, equals, exists, floor, floorIndex, get, getFirstIndex, getLastIndex, getSize, indexOf, indexOf, isEmpty, lastIndexOf, lastIndexOf, remove, remove, set, toString |
CopyOnWriteLongArray
public CopyOnWriteLongArray()
- Default constructor.
CopyOnWriteLongArray
public CopyOnWriteLongArray(java.lang.Class clazz)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException
- Construct a CopyOnWriteLongArray with an underlying array of the specified type.
- Parameters:
clazz
- the type of the internal array; must implement LongArray and have a public no-arg constructor
- Throws:
java.lang.ClassCastException
- if the specified type does not implement LongArray
java.lang.IllegalAccessException
- if the class or its no-arg constructor is not accessible
java.lang.InstantiationException
- if the specified Class represents an abstract class or interface; or if the class does not have a no-arg constructor; or if the instantiation fails for some other reason.
CopyOnWriteLongArray
public CopyOnWriteLongArray(com.oracle.common.collections.LongArray array)
- Construct a CopyOnWriteLongArray, initialized with the contents of the specified LongArray.
- Parameters:
array
- the initial LongArray
iterator
public LongArray.Iterator iterator()
-
- Specified by:
iterator
in interface com.oracle.common.collections.LongArray
- Specified by:
iterator
in interface java.lang.Iterable
- Overrides:
iterator
in class com.oracle.common.collections.CopyOnWriteLongArray
iterator
public LongArray.Iterator iterator(long lIndex)
-
- Specified by:
iterator
in interface com.oracle.common.collections.LongArray
- Overrides:
iterator
in class com.oracle.common.collections.CopyOnWriteLongArray
reverseIterator
public LongArray.Iterator reverseIterator()
-
- Specified by:
reverseIterator
in interface com.oracle.common.collections.LongArray
- Overrides:
reverseIterator
in class com.oracle.common.collections.CopyOnWriteLongArray
reverseIterator
public LongArray.Iterator reverseIterator(long lIndex)
-
- Specified by:
reverseIterator
in interface com.oracle.common.collections.LongArray
- Overrides:
reverseIterator
in class com.oracle.common.collections.CopyOnWriteLongArray
instantiateUnmodifiableIterator
public com.oracle.common.collections.LongArray.Iterator instantiateUnmodifiableIterator(com.oracle.common.collections.LongArray.Iterator iterator)
-
- Overrides:
instantiateUnmodifiableIterator
in class com.oracle.common.collections.CopyOnWriteLongArray
Skip navigation links
Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.