public class RSet<E> extends RCollection<E> implements Set<E>
add(E)
and other default mechanisms for
updating the set will not trigger a notification if the updated element is equal to an
element already in the set. Use addForce(E)
to force a notification. Similarly, remove(java.lang.Object)
will only generate a notification if an element was actually removed, use removeForce(E)
to force a notification.Modifier and Type | Class and Description |
---|---|
static class |
RSet.Listener<E>
An interface for publishing set events to listeners.
|
Reactor.RListener
Constructor and Description |
---|
RSet(Set<E> impl)
Creates a reactive set with the supplied underlying set implementation.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(E elem) |
boolean |
addAll(Collection<? extends E> coll) |
boolean |
addForce(E elem)
Adds the supplied element to the set, forcing a notification to the listeners regardless of
whether the element was already in the set or not.
|
void |
clear() |
Connection |
connect(RSet.Listener<? super E> listener)
Connects the supplied listener to this set, such that it will be notified on adds and
removes.
|
Connection |
connectNotify(RSet.Listener<? super E> listener)
Invokes
onAdd for all existing elements, and then connects listener . |
boolean |
contains(Object key) |
boolean |
containsAll(Collection<?> coll) |
ValueView<Boolean> |
containsView(E elem)
Returns a value that models whether the specified element is contained in this map.
|
static <E> RSet<E> |
create()
Creates a reactive set backed by a @{link HashSet}.
|
static <E> RSet<E> |
create(Set<E> impl)
Creates a reactive set with the supplied underlying set implementation.
|
void |
disconnect(RSet.Listener<? super E> listener)
Disconnects the supplied listener from this set if listen was called with it.
|
boolean |
equals(Object other) |
int |
hashCode() |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
boolean |
remove(Object rawElem) |
boolean |
removeAll(Collection<?> coll) |
boolean |
removeForce(E elem)
Removes the supplied element from the set, forcing a notification to the listeners
regardless of whether the element was already in the set or not.
|
boolean |
retainAll(Collection<?> coll) |
int |
size()
Returns the number of elements in this collection.
|
Object[] |
toArray() |
<T> T[] |
toArray(T[] array) |
String |
toString() |
isEmptyView, isNonEmptyView, sizeView
clearConnections, hasConnections
spliterator
parallelStream, removeIf, stream
public static <E> RSet<E> create()
public static <E> RSet<E> create(Set<E> impl)
public Connection connect(RSet.Listener<? super E> listener)
public Connection connectNotify(RSet.Listener<? super E> listener)
onAdd
for all existing elements, and then connects listener
.public void disconnect(RSet.Listener<? super E> listener)
public boolean addForce(E elem)
public boolean removeForce(E elem)
public ValueView<Boolean> containsView(E elem)
addForce(E)
or removeForce(E)
will cause this view to trigger and incorrectly report
that the element was not or was previously contained in the set. Caveat user.public int size()
RCollection
size
in interface Collection<E>
size
in interface Set<E>
size
in class RCollection<E>
public boolean isEmpty()
public boolean contains(Object key)
public boolean add(E elem)
public boolean remove(Object rawElem)
public boolean containsAll(Collection<?> coll)
containsAll
in interface Collection<E>
containsAll
in interface Set<E>
public boolean addAll(Collection<? extends E> coll)
public boolean retainAll(Collection<?> coll)
public boolean removeAll(Collection<?> coll)
public void clear()
public Object[] toArray()
public <T> T[] toArray(T[] array)
public int hashCode()
public boolean equals(Object other)
Copyright © 2017. All rights reserved.