|
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.SubSet
public class SubSet
Implements a set which is based on another set, which is assumed to be immutable. Unlike DeltaSet, the SubSet is assumed to be a subset of the underlying set, and optimizes for both remove and retain operations.
Nested Class Summary | |
---|---|
protected class |
SubSet.SubSetIterator Iterator for the contents of a subset in the "removed" mode. |
Constructor Summary | |
---|---|
SubSet(java.util.Set set) Construct this set based on an existing set. |
Method Summary | |
---|---|
boolean |
add(java.lang.Object o) Ensures that this Collection contains the specified element. |
boolean |
addAll(java.util.Collection col) Adds all of the elements in the specified collection to this collection. |
void |
clear() Removes all of the elements from this Collection. |
java.lang.Object |
clone() Clone the subset. |
boolean |
contains(java.lang.Object o) Returns true if this Collection contains the specified element. |
boolean |
containsAll(java.util.Collection col) Returns true if this collection contains all of the elements in the specified collection. |
protected java.util.Set |
ensureRemoved() Get a mutable set of items that are removed in the subset. |
protected java.util.Set |
ensureRetained() Get a mutable set of items that are retained in the subset. |
java.util.Set |
getOriginal() Determine what items were in the original set. |
java.util.Set |
getRemoved() Determine what items were removed from the subset. |
java.util.Set |
getRetained() Determine what items were added to the subset. |
protected java.util.Set |
instantiateModificationSet(int cSize) Instantiate a new modification set containing either removed or retained items. |
boolean |
isEmpty() Determine if the SubSet is empty. |
boolean |
isModified() Determine if the set has been modified. |
boolean |
isTrackingRemoved() Determine if the SubSet is tracking removed items versus retained items. |
boolean |
isTrackingRetained() Determine if the SubSet is tracking retained items versus removed items. |
java.util.Iterator |
iterator() Returns an Iterator over the elements contained in this Collection. |
boolean |
remove(java.lang.Object o) Removes a single instance of the specified element from this Collection, if it is present (optional operation). |
boolean |
removeAll(java.util.Collection col) Removes all this collection's elements that are also contained in the specified collection (optional operation). |
void |
reset() Discard the changes to the set ("rollback"). |
protected void |
resetState(java.util.Set setOrig, java.util.Set setMod, boolean fRetained) Reset the state of the subset according to the specified parameters. |
void |
resolve() Apply the changes to the underlying set ("commit"). |
boolean |
retainAll(java.util.Collection col) Retains only the elements in this collection that are contained in the specified collection (optional operation). |
protected void |
retainAllInternal(java.util.Collection colOuter, java.util.Collection colMatch, java.util.Set setExclude) Instantiate a new retained set with all elements in the specified collection that also exist in the provided colMatch collection and are not excluded. |
int |
size() Returns the number of elements in this Collection. |
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 with a runtime type is that of the specified array and that contains all of the elements in this collection. |
Methods inherited from class java.util.AbstractSet |
---|
equals, hashCode |
Methods inherited from class java.util.AbstractCollection |
---|
toString |
Constructor Detail |
---|
public SubSet(java.util.Set set)
set
- the set to base this subset onMethod Detail |
---|
public java.util.Set getOriginal()
public boolean isModified()
public boolean isTrackingRetained()
public java.util.Set getRetained()
public boolean isTrackingRemoved()
public java.util.Set getRemoved()
protected java.util.Set instantiateModificationSet(int cSize)
cSize
- an initial size of the modification setprotected java.util.Set ensureRetained()
protected java.util.Set ensureRemoved()
public void resolve()
public void reset()
protected void resetState(java.util.Set setOrig, java.util.Set setMod, boolean fRetained)
setOrig
- the new original setsetMod
- the set of removed or retained entries, depending on the fRetained
flagfRetained
- if true setMod
contains the retained entries; otherwise the removed entriespublic 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 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 search for in the setpublic boolean containsAll(java.util.Collection col)
containsAll
in interface java.util.Collection
containsAll
in interface java.util.Set
containsAll
in class java.util.AbstractCollection
col
- collection to be checked for containment in this collectionpublic 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 whose presence in this Collection is to be ensuredpublic boolean addAll(java.util.Collection col)
addAll
in interface java.util.Collection
addAll
in interface java.util.Set
addAll
in class java.util.AbstractCollection
col
- collection of elements to be inserted into this collectionpublic boolean remove(java.lang.Object o)
e
such that (o==null ? e==null : o.equals(e))
, if the Collection contains one or more such elements. Returns true if the Collection contained the specified element (or equivalently, if the Collection changed as a result of the call).remove
in interface java.util.Collection
remove
in interface java.util.Set
remove
in class java.util.AbstractCollection
o
- element to be removed from this Collection, if presentpublic boolean removeAll(java.util.Collection col)
removeAll
in interface java.util.Collection
removeAll
in interface java.util.Set
removeAll
in class java.util.AbstractSet
col
- elements to be removed from this collectionpublic boolean retainAll(java.util.Collection col)
retainAll
in interface java.util.Collection
retainAll
in interface java.util.Set
retainAll
in class java.util.AbstractCollection
col
- elements to be retained in this collection.public void clear()
clear
in interface java.util.Collection
clear
in interface java.util.Set
clear
in class java.util.AbstractCollection
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[] ao)
If the collection fits in the specified array with room to spare (i.e., the array has more elements than the collection), the element in the array immediately following the end of the collection is set to null. This is useful in determining the length of the collection only if the caller knows that the collection does not contain any null elements.)
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 the collection 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 runtime type of the specified array is not a supertype of the runtime type of every element in this collectionpublic java.lang.Object clone()
protected void retainAllInternal(java.util.Collection colOuter, java.util.Collection colMatch, java.util.Set setExclude)
colMatch
collection and are not excluded.colOuter
- collection to iteratecolMatch
- each element in colOuter should be present in this collection such that (colOuter ∩ colMatch)
setExclude
- optional set of excluded elements
|
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 |