|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
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.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(java.util.Collection collection) Construct a LiteSet containing the elements of the passed Collection. |
Method Summary | |
---|---|
boolean |
add(java.lang.Object o) Ensures that this Set contains the specified element. |
boolean |
addAll(java.util.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. |
java.lang.Object |
clone() Create a clone of this Set. |
boolean |
contains(java.lang.Object o) Returns true if this Set contains the specified element. |
boolean |
containsAll(java.util.Collection collection) Returns true if this Set contains all of the elements in the specified Collection. |
java.util.Enumeration |
elements() Returns an Enumerator over the elements in this Set. |
protected void |
initFromArray(java.lang.Object[] ao, int c) Initialize the contents of this Set from the passed array ao containing c values. |
protected java.util.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. |
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 data in the passed ObjectInput stream. |
boolean |
remove(java.lang.Object o) Removes the specified element from this Set if it is present. |
boolean |
removeAll(java.util.Collection collection) Removes from this Set all of its elements that are contained in the specified Collection. |
boolean |
retainAll(java.util.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). |
java.lang.Object[] |
toArray() Returns an array containing all of the elements in this Set. |
java.lang.Object[] |
toArray(java.lang.Object[] aDest) Returns an array (whose runtime type is that of the specified array) containing all of the elements in this Set. |
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 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(java.util.Collection collection)
collection
- a CollectionMethod Detail |
---|
public boolean isEmpty()
isEmpty
in interface java.util.Collection
isEmpty
in interface java.util.Set
isEmpty
in class java.util.AbstractCollection
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)
e
such that (o==null ? e==null : o.equals(e))
.contains
in interface java.util.Collection
contains
in interface java.util.Set
contains
in class java.util.AbstractCollection
o
- the object to check forpublic 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.util.Enumeration elements()
public java.lang.Object[] toArray()
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[] aDest)
toArray
in interface java.util.Collection
toArray
in interface java.util.Set
toArray
in class java.util.AbstractCollection
aDest
- 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
- if the component type of aDest is not a supertype of the 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)
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 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 collection)
containsAll
in interface java.util.Collection
containsAll
in interface java.util.Set
containsAll
in class java.util.AbstractCollection
collection
- Collection to be checked for containment in this Setpublic boolean addAll(java.util.Collection collection)
addAll
in interface java.util.Collection
addAll
in interface java.util.Set
addAll
in class java.util.AbstractCollection
collection
- Collection whose elements are to be added to this Setpublic boolean retainAll(java.util.Collection collection)
retainAll
in interface java.util.Collection
retainAll
in interface java.util.Set
retainAll
in class java.util.AbstractCollection
collection
- collection that defines which elements this Set will retainpublic boolean removeAll(java.util.Collection collection)
removeAll
in interface java.util.Collection
removeAll
in interface java.util.Set
removeAll
in class java.util.AbstractSet
collection
- Collection that defines which elements will be removed from this Setpublic void clear()
clear
in interface java.util.Collection
clear
in interface java.util.Set
clear
in class java.util.AbstractCollection
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.Set instantiateSet()
protected void initFromArray(java.lang.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()
|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |