|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
java.util.AbstractCollection
java.util.AbstractSet
com.tangosol.util.MapSet
public class MapSet
An ExternalizableLite implementation of java.util.Set that uses an underlying Map object to store its data in, just as the Java HashSet implementation uses an underlying HashMap for its element storage.
Field Summary | |
---|---|
protected java.util.Map |
m_map The underlying Map. |
protected static java.lang.Object |
NO_VALUE A no-value object. |
Constructor Summary | |
---|---|
MapSet() Default constructor. |
|
MapSet(java.util.Map map) Construct a MapSet that uses the given Map for its underlying storage. |
Method Summary | |
---|---|
boolean |
add(java.lang.Object o) Ensures that this Set contains the specified element. |
boolean |
addAll(java.util.Collection coll) Adds all of the elements in the specified Collection to this Set if they're not already present. |
void |
clear() Removes all of the elements from this Set. |
java.lang.Object |
clone() Create a clone of this MapSet. |
boolean |
contains(java.lang.Object o) Returns true if this Set contains the specified element. |
boolean |
containsAll(java.util.Collection coll) Returns true if this Set contains all of the elements in the specified Collection. |
java.util.Map |
getMap() Obtain the underlying Map for purposes of synchronization or read-only access; the caller must never directly modify the returned Map. |
protected java.util.Map |
instantiateMap() Factory pattern: Provide an underlying Map for this Set implementation to store its contents in. |
java.util.Iterator |
iterator() Returns an iterator over the elements in this Set. |
void |
readExternal(java.io.DataInput in) Restore the contents of this object by loading the object's state from the passed DataInput object. |
void |
readExternal(java.io.ObjectInput in) Initialize this object from the contents of the passed object stream. |
boolean |
remove(java.lang.Object o) Removes the specified element from this Set if it is present. |
boolean |
removeAll(java.util.Collection coll) Removes from this Set all of its elements that are contained in the specified Collection. |
boolean |
retainAll(java.util.Collection coll) Retains only the elements in this Set that are contained in the specified Collection. |
int |
size() Returns the number of elements in this Set. |
java.lang.Object[] |
toArray() Returns an array containing all of the elements in this Set. |
java.lang.Object[] |
toArray(java.lang.Object[] ao) Returns an array containing all of the elements in this set whose runtime type is that of the specified array. |
void |
writeExternal(java.io.DataOutput out) Save the contents of this object by storing the object's state into the passed DataOutput object. |
void |
writeExternal(java.io.ObjectOutput out) Write the contents of this object into the passed object stream. |
Methods inherited from class java.util.AbstractSet |
---|
equals, hashCode |
Methods inherited from class java.util.AbstractCollection |
---|
isEmpty, toString |
Methods inherited from interface java.util.Set |
---|
isEmpty |
Field Detail |
---|
protected static final java.lang.Object NO_VALUE
protected transient java.util.Map m_map
Constructor Detail |
---|
public MapSet()
MapSet(Map)
constructor. To change the default Map implementation, sub-class the MapSet and override the instantiateMap()
method.public MapSet(java.util.Map map)
map
- the underlying Map objectMethod Detail |
---|
public int size()
size
in interface java.util.Collection
size
in interface java.util.Set
size
in class java.util.AbstractCollection
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection
contains
in interface java.util.Set
contains
in class java.util.AbstractCollection
o
- object to be checked for containment in this collection.public java.util.Iterator iterator()
iterator
in interface java.lang.Iterable
iterator
in interface java.util.Collection
iterator
in interface java.util.Set
iterator
in class java.util.AbstractCollection
public java.lang.Object[] toArray()
Collection.toArray()
method.toArray
in interface java.util.Collection
toArray
in interface java.util.Set
toArray
in class java.util.AbstractCollection
public java.lang.Object[] toArray(java.lang.Object[] ao)
Collection.toArray(Object[])
method.toArray
in interface java.util.Collection
toArray
in interface java.util.Set
toArray
in class java.util.AbstractCollection
ao
- the array into which the elements of this Set are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purposejava.lang.ArrayStoreException
- the runtime type of a is not a supertype of the runtime type of every element in this Setpublic boolean add(java.lang.Object o)
add
in interface java.util.Collection
add
in interface java.util.Set
add
in class java.util.AbstractCollection
o
- element to be added to this Setpublic boolean remove(java.lang.Object o)
remove
in interface java.util.Collection
remove
in interface java.util.Set
remove
in class java.util.AbstractCollection
o
- object to be removed from this Set, if presentpublic boolean containsAll(java.util.Collection coll)
containsAll
in interface java.util.Collection
containsAll
in interface java.util.Set
containsAll
in class java.util.AbstractCollection
coll
- Collection to be checked for containment in this Setcontains(Object)
public boolean addAll(java.util.Collection coll)
addAll
in interface java.util.Collection
addAll
in interface java.util.Set
addAll
in class java.util.AbstractCollection
coll
- Collection whose elements are to be added to this Setadd(Object)
public boolean retainAll(java.util.Collection coll)
retainAll
in interface java.util.Collection
retainAll
in interface java.util.Set
retainAll
in class java.util.AbstractCollection
coll
- Collection that defines which elements this Set will retainAbstractCollection.remove(Object)
, AbstractCollection.contains(Object)
public boolean removeAll(java.util.Collection coll)
removeAll
in interface java.util.Collection
removeAll
in interface java.util.Set
removeAll
in class java.util.AbstractSet
coll
- Collection that defines which elements will be removed from this Setremove(Object)
public void clear()
clear
in interface java.util.Collection
clear
in interface java.util.Set
clear
in class java.util.AbstractCollection
public java.util.Map getMap()
public java.lang.Object clone()
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
in
- the stream to read data from in order to restore the objectjava.io.IOException
- if an I/O exception occursjava.lang.ClassNotFoundException
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
out
- the stream to write the object tojava.io.IOException
- if an I/O exception occurspublic void readExternal(java.io.DataInput in) throws java.io.IOException
readExternal
in interface ExternalizableLite
in
- the DataInput stream to read data from in order to restore the state of this objectjava.io.IOException
- if an I/O exception occursjava.io.NotActiveException
- if the object is not in its initial state, and therefore cannot be deserialized intopublic void writeExternal(java.io.DataOutput out) throws java.io.IOException
writeExternal
in interface ExternalizableLite
out
- the DataOutput stream to write the state of this object tojava.io.IOException
- if an I/O exception occursprotected java.util.Map instantiateMap()
|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |