|
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.LiteSet
public class LiteSet
An implementation of java.util.Set that is optimal (in terms of both size and speed) for very small sets of data but still works excellently with large sets of data. This implementation is not thread-safe.
The LiteSet implementation switches at runtime between several different sub-implementations for storing the set of objects, described here:
instantiateSet().
The LiteSet implementation supports the null value.
| Constructor Summary | |
|---|---|
LiteSet()
Construct a LiteSet |
|
LiteSet(Collection collection)
Construct a LiteSet containing the elements of the passed Collection. |
|
| Method Summary | |
|---|---|
boolean |
add(Object o)
Ensures that this Set contains the specified element. |
boolean |
addAll(Collection collection)
Adds all of the elements in the specified Collection to this Set if they are not already present. |
protected void |
checkShrinkFromOther()
After a mutation operation has reduced the size of an underlying Set, check if the delegation model should be replaced with a more size- efficient storage approach, and switch accordingly. |
void |
clear()
Removes all of the elements from this Set. |
Object |
clone()
Create a clone of this Set. |
boolean |
contains(Object o)
Returns true if this Set contains the specified element. |
boolean |
containsAll(Collection collection)
Returns true if this Set contains all of the elements in the specified Collection. |
Enumeration |
elements()
Returns an Enumerator over the elements in this Set. |
protected void |
initFromArray(Object[] ao,
int c)
Initialize the contents of this Set from the passed array ao containing c values. |
protected Set |
instantiateSet()
(Factory pattern) Instantiate a Set object to store items in once the "lite" threshold has been exceeded. |
boolean |
isEmpty()
Determine if this Set is empty. |
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 data in the passed ObjectInput stream. |
boolean |
remove(Object o)
Removes the specified element from this Set if it is present. |
boolean |
removeAll(Collection collection)
Removes from this Set all of its elements that are contained in the specified Collection. |
boolean |
retainAll(Collection collection)
Retains only the elements in this Set that are contained in the specified Collection. |
int |
size()
Returns the number of elements in this Set (its cardinality). |
Object[] |
toArray()
Returns an array containing all of the elements in this Set. |
Object[] |
toArray(Object[] aDest)
Returns an array (whose runtime type is that of the specified array) containing all of the elements in this Set. |
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 this object's data to the passed ObjectOutput stream. |
| Methods inherited from class java.util.AbstractSet |
|---|
equals, hashCode |
| Methods inherited from class java.util.AbstractCollection |
|---|
toString |
| Constructor Detail |
|---|
public LiteSet()
public LiteSet(Collection collection)
collection - a Collection| Method Detail |
|---|
public boolean isEmpty()
isEmpty in interface CollectionisEmpty in interface SetisEmpty in class AbstractCollectionpublic int size()
size in interface Collectionsize in interface Setsize in class AbstractCollectionpublic boolean contains(Object o)
e such that
(o==null ? e==null : o.equals(e)).
contains in interface Collectioncontains in interface Setcontains in class AbstractCollectiono - the object to check for
public Iterator iterator()
iterator in interface Iterableiterator in interface Collectioniterator in interface Setiterator in class AbstractCollectionpublic Enumeration elements()
public Object[] toArray()
toArray in interface CollectiontoArray in interface SettoArray in class AbstractCollectionpublic Object[] toArray(Object[] aDest)
toArray in interface CollectiontoArray in interface SettoArray in class AbstractCollectionaDest - 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 - if the component type of aDest is
not a supertype of the type of every element in this Setpublic boolean add(Object o)
add in interface Collectionadd in interface Setadd in class AbstractCollectiono - element to be added to this Set
public boolean remove(Object o)
e such that
(o==null ? e==null : o.equals(e)), if the Set contains
such an element. Returns true if the Set contained the
specified element (or equivalently, if the Set changed as a result of
the call). The Set will not contain the specified element once the call
returns.
remove in interface Collectionremove in interface Setremove in class AbstractCollectiono - object to be removed from this Set, if present
public boolean containsAll(Collection collection)
containsAll in interface CollectioncontainsAll in interface SetcontainsAll in class AbstractCollectioncollection - Collection to be checked for containment in this
Set
public boolean addAll(Collection collection)
addAll in interface CollectionaddAll in interface SetaddAll in class AbstractCollectioncollection - Collection whose elements are to be added to this
Set
public boolean retainAll(Collection collection)
retainAll in interface CollectionretainAll in interface SetretainAll in class AbstractCollectioncollection - collection that defines which elements this Set will
retain
public boolean removeAll(Collection collection)
removeAll in interface CollectionremoveAll in interface SetremoveAll in class AbstractSetcollection - Collection that defines which elements will be
removed from this Set
public void clear()
clear in interface Collectionclear in interface Setclear in class AbstractCollectionpublic Object clone()
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
readExternal in interface Externalizablein - 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 Externalizableout - the stream to write the object to
IOException - if an I/O exception occurs
public void readExternal(DataInput in)
throws IOException
readExternal in interface ExternalizableLitein - 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 into
public void writeExternal(DataOutput out)
throws IOException
writeExternal in interface ExternalizableLiteout - the DataOutput stream to write the state of this object to
IOException - if an I/O exception occursprotected Set instantiateSet()
protected void initFromArray(Object[] ao,
int c)
ao - the array that contains the values to place in this Setc - the number of values that will be placed into this Setprotected void checkShrinkFromOther()
|
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 | |||||||