public class ObservableSetWrapper<E> extends Object implements ObservableSet<E>
| Constructor and Description |
|---|
ObservableSetWrapper(Set<E> set)
Creates new instance of ObservableSet that wraps
the particular set specified by the parameter set.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E o)
Adds the specific element into this set and call all the
registered observers unless the set already contains the element.
|
boolean |
addAll(Collection<? extends E> c)
Adds the elements from the specified collection.
|
void |
addListener(InvalidationListener listener)
Adds an
InvalidationListener which will be notified whenever the
Observable becomes invalid. |
void |
addListener(SetChangeListener<? super E> observer)
Add a listener to this observable set.
|
void |
clear()
Removes all the elements from this set.
|
boolean |
contains(Object o)
Returns true if this set contains specified element.
|
boolean |
containsAll(Collection<?> c)
Test this set if it contains all the elements in the specified collection.
|
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" the wrapped set.
|
int |
hashCode()
Returns the hash code for the wrapped set.
|
boolean |
isEmpty()
Returns true if this set contains no elements.
|
Iterator |
iterator()
Returns an iterator over the elements in this set.
|
boolean |
remove(Object o)
Removes the specific element from this set and call all the
registered observers if the set contained the element.
|
boolean |
removeAll(Collection<?> c)
Removes all the elements that are contained in the specified
collection.
|
void |
removeListener(InvalidationListener listener)
Removes the given listener from the list of listeners, that are notified
whenever the value of the
Observable becomes invalid. |
void |
removeListener(SetChangeListener<? super E> observer)
Tries to removed a listener from this observable set.
|
boolean |
retainAll(Collection<?> c)
Keeps only elements that are included the specified collection.
|
int |
size()
Returns number of elements contained in this set.
|
Object[] |
toArray()
Returns an array containing all of the elements in this set.
|
<T> T[] |
toArray(T[] a)
Returns an array containing all of the elements in this set.
|
String |
toString()
Returns the String representation of the wrapped set.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitspliteratorparallelStream, removeIf, streampublic void addListener(InvalidationListener listener)
InvalidationListener which will be notified whenever the
Observable becomes invalid. If the same
listener is added more than once, then it will be notified more than
once. That is, no check is made to ensure uniqueness.
Note that the same actual InvalidationListener instance may be
safely registered for different Observables.
The Observable stores a strong reference to the listener
which will prevent the listener from being garbage collected and may
result in a memory leak. It is recommended to either unregister a
listener by calling removeListener after use or to use an instance of
WeakInvalidationListener avoid this situation.
addListener in interface Observablelistener - The listener to registerObservable.removeListener(InvalidationListener)public void removeListener(InvalidationListener listener)
Observable becomes invalid.
If the given listener has not been previously registered (i.e. it was never added) then this method call is a no-op. If it had been previously added then it will be removed. If it had been added more than once, then only the first occurrence will be removed.
removeListener in interface Observablelistener - The listener to removeObservable.addListener(InvalidationListener)public void addListener(SetChangeListener<? super E> observer)
addListener in interface ObservableSet<E>observer - the listener for listening to the set changespublic void removeListener(SetChangeListener<? super E> observer)
removeListener in interface ObservableSet<E>observer - a listener to removepublic int size()
size in interface Collection<E>size in interface Set<E>in JDK API documentationpublic boolean isEmpty()
isEmpty in interface Collection<E>isEmpty in interface Set<E>in JDK API documentationpublic boolean contains(Object o)
contains in interface Collection<E>contains in interface Set<E>o - an element that is being looked forin JDK API documentationpublic Iterator iterator()
remove() method is called then the
registered observers are called as well.iterator in interface Iterable<E>iterator in interface Collection<E>iterator in interface Set<E>in JDK API documentationpublic Object[] toArray()
toArray in interface Collection<E>toArray in interface Set<E>in JDK API documentationpublic <T> T[] toArray(T[] a)
toArray in interface Collection<E>toArray in interface Set<E>a - 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 allocatedin JDK API documentationpublic boolean add(E o)
add in interface Collection<E>add in interface Set<E>o - the element to be added to the setin JDK API documentationpublic boolean remove(Object o)
remove in interface Collection<E>remove in interface Set<E>o - the element to be removed from the setin JDK API documentationpublic boolean containsAll(Collection<?> c)
containsAll in interface Collection<E>containsAll in interface Set<E>c - collection to be checked for containment in this setin JDK API documentationpublic boolean addAll(Collection<? extends E> c)
addAll in interface Collection<E>addAll in interface Set<E>c - collection containing elements to be added to this setin JDK API documentationpublic boolean retainAll(Collection<?> c)
retainAll in interface Collection<E>retainAll in interface Set<E>c - collection containing elements to be kept in this setin JDK API documentationpublic boolean removeAll(Collection<?> c)
removeAll in interface Collection<E>removeAll in interface Set<E>c - collection containing elements to be removed from this setin JDK API documentationpublic void clear()
clear in interface Collection<E>clear in interface Set<E>in JDK API documentationpublic String toString()
toString in class Objectin JDK API documentationpublic boolean equals(Object obj)
equals in interface Collection<E>equals in interface Set<E>equals in class Objectobj - the reference object with which to comparein JDK API documentationpublic int hashCode()
hashCode in interface Collection<E>hashCode in interface Set<E>hashCode in class Objectin JDK API documentationCopyright © 2025. All rights reserved.