Skip to content

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.

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.

ReturnsSignatureSummary
SetSignal()Creates a signal whose value and default value are an empty set.
SetSignal(Collection value)Creates a signal whose value and default value are the distinct elements of value, in its iteration order.

ReturnsSignatureSummary
thisclear() fluentRemoves every element, then returns this signal.
thisadd(E e) fluentAdds e, then returns this signal; an element already in the set changes nothing.
thisremove(E e) fluentRemoves e, then returns this signal; nothing changes when the set does not hold it.
booleancontains(E e)If true, the set holds e.
booleanisEmpty()If true, the set holds no element.
intsize()Returns the number of elements.
ReturnsSignatureSummary
Set<E>seal(Set value) hook protectedReturns 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

Inherited from Signal (1)

onChange

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.

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.

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

Report a problem with this page