|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.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 Map |
m_map
The underlying Map. |
protected static Object |
NO_VALUE
A no-value object. |
Constructor Summary | |
---|---|
MapSet()
Default constructor. |
|
MapSet(Map map)
Construct a Map from the |
Method Summary | |
---|---|
boolean |
add(Object o)
Ensures that this Set contains the specified element. |
boolean |
addAll(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. |
Object |
clone()
Create a clone of this MapSet. |
boolean |
contains(Object o)
Returns true if this Set contains the specified element. |
boolean |
containsAll(Collection coll)
Returns true if this Set contains all of the elements in the specified Collection. |
Map |
getMap()
Obtain the underlying Map for purposes of synchronization or read-only access; the caller must never directly modify the returned Map. |
protected Map |
instantiateMap()
Factory pattern: Provide an underlying Map for this Set implementation to store its contents in. |
Iterator |
iterator()
Returns an iterator over the elements in this Set. |
void |
readExternal(DataInput in)
Restore the contents of this object by loading the object's state from the passed DataInput object. |
void |
readExternal(ObjectInput in)
Initialize this object from the contents of the passed object stream. |
boolean |
remove(Object o)
Removes the specified element from this Set if it is present. |
boolean |
removeAll(Collection coll)
Removes from this Set all of its elements that are contained in the specified Collection. |
boolean |
retainAll(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. |
Object[] |
toArray()
Returns an array containing all of the elements in this Set. |
Object[] |
toArray(Object[] ao)
Returns an array containing all of the elements in this set whose runtime type is that of the specified array. |
void |
writeExternal(DataOutput out)
Save the contents of this object by storing the object's state into the passed DataOutput object. |
void |
writeExternal(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 Object NO_VALUE
protected transient 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(Map map)
Method Detail |
---|
public int size()
size
in interface Collection
size
in interface Set
size
in class AbstractCollection
public boolean contains(Object o)
contains
in interface Collection
contains
in interface Set
contains
in class AbstractCollection
public Iterator iterator()
iterator
in interface Iterable
iterator
in interface Collection
iterator
in interface Set
iterator
in class AbstractCollection
public Object[] toArray()
Collection.toArray()
method.
toArray
in interface Collection
toArray
in interface Set
toArray
in class AbstractCollection
public Object[] toArray(Object[] ao)
Collection.toArray(Object[])
method.
toArray
in interface Collection
toArray
in interface Set
toArray
in class 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 purpose
ArrayStoreException
- the runtime type of a is not a supertype
of the runtime type of every element in this Setpublic boolean add(Object o)
add
in interface Collection
add
in interface Set
add
in class AbstractCollection
o
- element to be added to this Set
public boolean remove(Object o)
remove
in interface Collection
remove
in interface Set
remove
in class AbstractCollection
o
- object to be removed from this Set, if present
public boolean containsAll(Collection coll)
containsAll
in interface Collection
containsAll
in interface Set
containsAll
in class AbstractCollection
coll
- Collection to be checked for containment in this Set
contains(Object)
public boolean addAll(Collection coll)
addAll
in interface Collection
addAll
in interface Set
addAll
in class AbstractCollection
coll
- Collection whose elements are to be added to this Set
add(Object)
public boolean retainAll(Collection coll)
retainAll
in interface Collection
retainAll
in interface Set
retainAll
in class AbstractCollection
coll
- Collection that defines which elements this Set will retain
public boolean removeAll(Collection coll)
removeAll
in interface Collection
removeAll
in interface Set
removeAll
in class AbstractSet
coll
- Collection that defines which elements will be removed
from this Set
remove(Object)
public void clear()
clear
in interface Collection
clear
in interface Set
clear
in class AbstractCollection
public Map getMap()
public Object clone()
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
in
- the stream to read data from in order to restore the object
IOException
- if an I/O exception occurs
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
out
- the stream to write the object to
IOException
- if an I/O exception occurspublic void readExternal(DataInput in) throws IOException
readExternal
in interface ExternalizableLite
in
- the DataInput stream to read data from in order to restore
the state of this object
IOException
- if an I/O exception occurs
NotActiveException
- if the object is not in its initial
state, and therefore cannot be deserialized intopublic void writeExternal(DataOutput out) throws IOException
writeExternal
in interface ExternalizableLite
out
- the DataOutput stream to write the state of this object to
IOException
- if an I/O exception occursprotected Map instantiateMap()
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |