Skip to content

MapSignal

class MapSignal<K, V>
Extends: Signal<Map<K,V>>
Package: dev.joid.lib.signal.impl.iterable · Module: core · Source: MapSignal.java

Signal of a map that keeps the insertion order of its keys, 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 keys keep the order in which they were first put.

ReturnsSignatureSummary
MapSignal()Creates a signal whose value and default value are an empty map.
MapSignal(Map<K,V> value)Creates a signal whose value and default value are a copy of value, in its iteration order.

ReturnsSignatureSummary
thisclear() fluentRemoves every entry, then returns this signal.
Vget(K key)Returns the value of key, or null when the map does not hold it.
thisput(K key, V value) fluentSets the value of key, then returns this signal; a key already present keeps its place.
thisremove(K key) fluentRemoves the entry of key, then returns this signal; nothing changes when the map does not hold it.
booleancontainsKey(K key)If true, the map holds an entry for key.
Set<Entry<K,V>>entrySet()Returns the entries, read-only, in the order of the keys.
booleanisEmpty()If true, the map holds no entry.
Set<K>keySet()Returns the keys, read-only, in their order.
intsize()Returns the number of entries.
Collection<V>values()Returns the values, read-only, in the order of their keys.
ReturnsSignatureSummary
Map<K,V>seal(Map<K,V> value) hook protectedReturns a read-only copy of value in the same order, which the signal stores.
Inherited from Signal (11)

batch · silent · peek · isPresent · isWritable · toString · from · set · reset · removeOnChange · map

Inherited from Signal (1)

onChange

MapSignal()

Creates a signal whose value and default value are an empty map.

MapSignal(Map<K,V> value)

Creates a signal whose value and default value are a copy of value, in its iteration order.

this clear() fluent

Removes every entry, then returns this signal.

V get(K key)

Returns the value of key, or null when the map does not hold it.

this put(K key, V value) fluent

Sets the value of key, then returns this signal; a key already present keeps its place.

this remove(K key) fluent

Removes the entry of key, then returns this signal; nothing changes when the map does not hold it.

boolean containsKey(K key)

If true, the map holds an entry for key.

Set<Entry<K,V>> entrySet()

Returns the entries, read-only, in the order of the keys.

boolean isEmpty()

If true, the map holds no entry.

Set<K> keySet()

Returns the keys, read-only, in their order.

int size()

Returns the number of entries.

Collection<V> values()

Returns the values, read-only, in the order of their keys.

Map<K,V> seal(Map<K,V> 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