SetSignal
class SetSignal<E>
Extends: Signal<Set<E>>
Package: dev.joid.lib.signal.impl.iterable · Module: core · Source: SetSignal.java
Signal of a set that keeps the insertion order, changed through its own methods so that every change notifies its followers.
Description
Section titled “Description”It works like ListSignal: the value is a read-only copy, each method writes a changed copy, and the read methods record the read.
The elements keep the order in which they were added.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
| SetSignal() | Creates a signal whose value and default value are an empty set. | |
| SetSignal(Collection | Creates a signal whose value and default value are the distinct elements of value, in its iteration order. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
this | clear() fluent | Removes every element, then returns this signal. |
this | add(E e) fluent | Adds e, then returns this signal; an element already in the set changes nothing. |
this | remove(E e) fluent | Removes e, then returns this signal; nothing changes when the set does not hold it. |
boolean | contains(E e) | If true, the set holds e. |
boolean | isEmpty() | If true, the set holds no element. |
int | size() | Returns the number of elements. |
For subclasses
Section titled “For subclasses”| Returns | Signature | Summary |
|---|---|---|
Set<E> | seal(Set | Returns a read-only copy of value in the same order, which the signal stores. |
Inherited from Signal (12)
batch · silent · get · peek · isPresent · isWritable · toString · from · set · reset · removeOnChange · map
Events
Section titled “Events”Creation details
Section titled “Creation details”SetSignal
Section titled “SetSignal”SetSignal()
Creates a signal whose value and default value are an empty set.
SetSignal(Collection<E> value)
Creates a signal whose value and default value are the distinct elements of value, in its iteration order.
Method details
Section titled “Method details”this clear() fluent
Removes every element, then returns this signal.
this add(E e) fluent
Adds e, then returns this signal; an element already in the set changes nothing.
remove
Section titled “remove”this remove(E e) fluent
Removes e, then returns this signal; nothing changes when the set does not hold it.
contains
Section titled “contains”boolean contains(E e)
If true, the set holds e.
isEmpty
Section titled “isEmpty”boolean isEmpty()
If true, the set holds no element.
int size()
Returns the number of elements.
Set<E> seal(Set<E> value) hook protected
Returns a read-only copy of value in the same order, which the signal stores.
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
