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.
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 keys keep the order in which they were first put.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
| 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. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
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. |
For subclasses
Section titled “For subclasses”| Returns | Signature | Summary |
|---|---|---|
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. |
Inherited from Signal (11)
batch · silent · peek · isPresent · isWritable · toString · from · set · reset · removeOnChange · map
Events
Section titled “Events”Creation details
Section titled “Creation details”MapSignal
Section titled “MapSignal”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.
Method details
Section titled “Method details”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.
remove
Section titled “remove”this remove(K key) fluent
Removes the entry of key, then returns this signal; nothing changes when the map does not hold it.
containsKey
Section titled “containsKey”boolean containsKey(K key)
If true, the map holds an entry for key.
entrySet
Section titled “entrySet”Set<Entry<K,V>> entrySet()
Returns the entries, read-only, in the order of the keys.
isEmpty
Section titled “isEmpty”boolean isEmpty()
If true, the map holds no entry.
keySet
Section titled “keySet”Set<K> keySet()
Returns the keys, read-only, in their order.
int size()
Returns the number of entries.
values
Section titled “values”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
