T - the type of element in this set
public class ObservableSet<T> extends Objectimplements Set <T>
Set that allows listeners.
This class is just a wrapper that manages the listeners; the actual work is done by another Set of your choice.
The synchronization model here is similar to (but not as thorough as) the architecture used for the ObservableList.
| Modifier and Type | Class and Description |
|---|---|
static interface |
ObservableSet
A listener for set modifications.
|
static class |
ObservableSet
This is thrown when notifying a
Listener resulted in further modifying this set.
|
static class |
ObservableSet
|
| Modifier and Type | Field and Description |
|---|---|
protected Semaphore |
readSemaphore
|
| Constructor and Description |
|---|
ObservableSet(Class
Create an ObservableSet that uses a HashSet.
|
ObservableSet(Class
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T e)
|
boolean |
addAll(Collection
|
void |
addChangeListener(ChangeListener
|
void |
addListener(ObservableSet
|
void |
clear()
|
boolean |
contains(Object
|
boolean |
containsAll(Collection
|
boolean |
equals(Object
|
protected <R> R |
execute(com
|
protected void |
fireAllListeners(ObservableSet
This fires first the Listeners, and then the ChangeListeners.
|
int |
hashCode()
|
boolean |
isEmpty()
|
Iterator |
iterator()
|
boolean |
remove(Object
|
boolean |
removeAll(Collection
|
void |
removeChangeListener(ChangeListener
|
void |
removeListener(ObservableSet
|
boolean |
retainAll(Collection
|
boolean |
set(Collection
|
int |
size()
|
Object |
toArray()
|
<S> S[] |
toArray(S[] a)
|
T[] |
toComponentArray()
Create an array returning all the elements of this set.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitspliteratorparallelStream, removeIf, streamprotected final SemaphorereadSemaphore
public ObservableSet(Class<T> componentType)
componentType - the component type to be used when converting this set to an array.
public void addListener(ObservableSet.Listener <T> l)
public void removeListener(ObservableSet.Listener <T> l)
public int size()
public boolean isEmpty()
public boolean contains(Objecto)
protected void fireAllListeners(ObservableSet.SetDataEvent <T> event)
public Object[] toArray()
public <S> S[] toArray(S[] a)
protected <R> R execute(com.bric .util .ObservableSet .Operation <R> op)
public boolean add(T e)
public boolean remove(Objecto)
public boolean containsAll(Collection<?> c)
public boolean addAll(Collection<? extends T> c)
public boolean retainAll(Collection<?> c)
public boolean removeAll(Collection<?> c)
public boolean set(Collection<T> newContents)
public void clear()
public boolean equals(Objecto)
public int hashCode()
public T[] toComponentArray()
This method uses the existing read/write locking architecture the ObservableSet uses, so it is safer than synchronizing this list to extract the elements separately.
public void addChangeListener(ChangeListenerchangeListener)
public void removeChangeListener(ChangeListenerchangeListener)