Package com.tangosol.util
Class InflatableCollection
java.lang.Object
java.util.AbstractCollection
com.tangosol.util.InflatableCollection
- All Implemented Interfaces:
Iterable,Collection
- Direct Known Subclasses:
InflatableList,InflatableSet
A Collection implementation which optimizes memory consumption for
collections that often contain just a single value. This implementation also
reduces contention for read operations (e.g. contains, iterator, etc.)
- Since:
- Coherence 3.6
- Author:
- ch 2009.11.22
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceA marker interface which is used to identify internally inflated Collections. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ObjectHolds NO_VALUE, a single value, or an InflatedCollection of values.protected static final ObjectA marker value indicating that the single value has not been initialized.protected static final AtomicReferenceFieldUpdater<InflatableCollection, Object> Atomic updater for collection values. -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
Field Details
-
NO_VALUE
A marker value indicating that the single value has not been initialized. -
VALUE_UPDATER
Atomic updater for collection values. Static atomic field updater rather thanAtomicReferenceis shared to reduce memory footprint of each InflatableCollection instance. (COH-9262) -
m_oValue
Holds NO_VALUE, a single value, or an InflatedCollection of values.
-
-
Constructor Details
-
InflatableCollection
public InflatableCollection()
-
-
Method Details
-
equals
- Specified by:
equalsin interfaceCollection- Overrides:
equalsin classObject
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection- Overrides:
hashCodein classObject
-
add
- Specified by:
addin interfaceCollection- Overrides:
addin classAbstractCollection
-
remove
- Specified by:
removein interfaceCollection- Overrides:
removein classAbstractCollection
-
removeAll
- Specified by:
removeAllin interfaceCollection- Overrides:
removeAllin classAbstractCollection
-
retainAll
- Specified by:
retainAllin interfaceCollection- Overrides:
retainAllin classAbstractCollection
-
clear
public void clear()- Specified by:
clearin interfaceCollection- Overrides:
clearin classAbstractCollection
-
contains
- Specified by:
containsin interfaceCollection- Overrides:
containsin classAbstractCollection
-
iterator
- Specified by:
iteratorin interfaceCollection- Specified by:
iteratorin interfaceIterable- Specified by:
iteratorin classAbstractCollection
-
size
public int size()- Specified by:
sizein interfaceCollection- Specified by:
sizein classAbstractCollection
-
toArray
- Specified by:
toArrayin interfaceCollection- Overrides:
toArrayin classAbstractCollection
-
toArray
- Specified by:
toArrayin interfaceCollection- Overrides:
toArrayin classAbstractCollection
-
instantiateCollection
Factory method used to create a new Collection. The returned Collection must provide a "safe" iterator.- Returns:
- a "real" implementation to use if this collection is expanded
-