Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


com.tangosol.util
Class InflatableCollection

java.lang.Object
  extended by java.util.AbstractCollection
      extended by com.tangosol.util.InflatableCollection

All Implemented Interfaces:
java.lang.Iterable, java.util.Collection
Direct Known Subclasses:
InflatableList, InflatableSet

public abstract class InflatableCollection
extends java.util.AbstractCollection

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
protected static interface InflatableCollection.InflatedCollection
          A marker interface which is used to identify internally inflated Collections.

 

Field Summary
protected  java.util.concurrent.atomic.AtomicReference m_refValue
          Holds NO_VALUE, a single value, or an InflatedCollection of values.
protected static java.lang.Object NO_VALUE
          A marker value indicating that the single value has not been initialized.

 

Constructor Summary
InflatableCollection()
           

 

Method Summary
 boolean add(java.lang.Object o)
          
 void clear()
          
 boolean contains(java.lang.Object o)
          
 boolean equals(java.lang.Object o)
          
 int hashCode()
          
protected abstract  InflatableCollection.InflatedCollection instantiateCollection()
          Factory method used to create a new Collection.
 java.util.Iterator iterator()
          
 boolean remove(java.lang.Object o)
          
 boolean removeAll(java.util.Collection c)
          
 boolean retainAll(java.util.Collection c)
          
 int size()
          
 java.lang.Object[] toArray()
          
 java.lang.Object[] toArray(java.lang.Object[] ao)
          

 

Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, toString

 

Field Detail

NO_VALUE

protected static final java.lang.Object NO_VALUE
A marker value indicating that the single value has not been initialized.

m_refValue

protected final java.util.concurrent.atomic.AtomicReference m_refValue
Holds NO_VALUE, a single value, or an InflatedCollection of values.

Constructor Detail

InflatableCollection

public InflatableCollection()

Method Detail

equals

public boolean equals(java.lang.Object o)

hashCode

public int hashCode()

add

public boolean add(java.lang.Object o)
Specified by:
add in interface java.util.Collection
Overrides:
add in class java.util.AbstractCollection

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection
Overrides:
remove in class java.util.AbstractCollection

removeAll

public boolean removeAll(java.util.Collection c)
Specified by:
removeAll in interface java.util.Collection
Overrides:
removeAll in class java.util.AbstractCollection

retainAll

public boolean retainAll(java.util.Collection c)
Specified by:
retainAll in interface java.util.Collection
Overrides:
retainAll in class java.util.AbstractCollection

clear

public void clear()
Specified by:
clear in interface java.util.Collection
Overrides:
clear in class java.util.AbstractCollection

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection
Overrides:
contains in class java.util.AbstractCollection

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in class java.util.AbstractCollection

size

public int size()
Specified by:
size in interface java.util.Collection
Specified by:
size in class java.util.AbstractCollection

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection
Overrides:
toArray in class java.util.AbstractCollection

toArray

public java.lang.Object[] toArray(java.lang.Object[] ao)
Specified by:
toArray in interface java.util.Collection
Overrides:
toArray in class java.util.AbstractCollection

instantiateCollection

protected abstract InflatableCollection.InflatedCollection 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

Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.