|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractSet
common.HashSetDiff
public class HashSetDiff
Implementation of SetDiff that uses hash sets to store additions and removals.
Constructor Summary | |
---|---|
HashSetDiff(java.util.Set underlying)
Creates a new HashSetDiff with the given underlying set. |
|
HashSetDiff(java.util.Set underlying,
boolean maintainOrder)
Creates a new HashSetDiff with the given underlying set. |
Method Summary | |
---|---|
boolean |
add(java.lang.Object o)
|
void |
changeUnderlying()
Changes the underlying set so it's equal to this set. |
void |
clearChanges()
Changes this set so it's equal to the underlying set. |
java.lang.Object |
clone()
Returns a shallow copy of this set diff, expressed relative to the same underlying set. |
boolean |
contains(java.lang.Object o)
|
protected java.util.Set |
copySet(java.util.Set orig)
|
java.util.Set |
getAdditions()
Returns the set of objects that are in this set and not in the underlying set. |
java.util.Set |
getRemovals()
Returns the set of objects that are in the underlying set but not in this set. |
java.util.Iterator |
iterator()
|
protected java.util.Set |
newSet()
|
boolean |
remove(java.lang.Object o)
|
int |
size()
|
Methods inherited from class java.util.AbstractSet |
---|
equals, hashCode, removeAll |
Methods inherited from class java.util.AbstractCollection |
---|
addAll, clear, containsAll, isEmpty, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
---|
addAll, clear, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray |
Constructor Detail |
---|
public HashSetDiff(java.util.Set underlying)
public HashSetDiff(java.util.Set underlying, boolean maintainOrder)
maintainOrder
is true, then this instance will use
LinkedHashSets to keep the order of iteration predictable.
Method 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
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 boolean add(java.lang.Object o)
add
in interface java.util.Collection
add
in interface java.util.Set
add
in class java.util.AbstractCollection
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection
remove
in interface java.util.Set
remove
in class java.util.AbstractCollection
public java.util.Set getAdditions()
SetDiff
getAdditions
in interface SetDiff
public java.util.Set getRemovals()
SetDiff
getRemovals
in interface SetDiff
public void changeUnderlying()
SetDiff
changeUnderlying
in interface SetDiff
public void clearChanges()
SetDiff
clearChanges
in interface SetDiff
public java.lang.Object clone()
clone
in class java.lang.Object
protected java.util.Set newSet()
protected java.util.Set copySet(java.util.Set orig)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |