A Map that provides fast reads and
synchronised writes between threads, ensuring data integrity.
The map is stored in an AtomicRef through which all reads are made.
All write operations (
clear ) are made via
synchronized blocks ensuring no data is lost during race conditions. Writing makes a
rw copy of the map and is thus a more expensive operation.
All values held in the map must be immutable.
const Bool caseInsensitive := false
Configures case sensitivity for maps with Str keys.
Remove all key/value pairs from the map. Return this.
trueif the map contains the given key
const Obj? def := null
The default value to use for get when a key isn't mapped.
Call the specified function for every key/value in the map.
Returns the value associated with the given key. If key is not mapped, then return the value of the
defis omitted it defaults to
Returns the value associated with the given key. If it doesn't exist then it is added from the value function.
This method is thread safe.
valFuncwill not be called twice for the same key.
valFuncshould be immutable and, if used, is executed in a different thread to the calling thread.
trueif size() == 0
const Type keyType := sys::Obj#
Used to parameterize the backing map. Must be non-nullable.
Returns a list of all the mapped keys.
const Synchronized lock
lockobject should you need to
synchronizeon the Map.
SynchronizedMapwith the given
const Bool ordered := false
truethe map will maintain the order in which key/value pairs are added.
Remove the key/value pair identified by the specified key from the map and return the value. If the key was not mapped then return
Get a read-write, mutable Map instance with the same contents.
Sets the key / value pair, ensuring no data is lost during multi-threaded race conditions. Both the
valmust be immutable.
Get the number of key/value pairs in the map.
virtual override Str toStr()
Returns a string representation the map.
Gets or sets a read-only copy of the backing map.
const Type valType := sys::Obj?#
Used to parameterize the backing map.
Returns a list of all the mapped values.