const class std::ConcurrentMap

sys::Obj
  std::ConcurrentMap

ConcurrentMap is a Fantom wrapper around Java's ConcurrentHashMap. It provides high performance concurrency and allows many operations to be performed without locking. Refer to the ConcurrentHashMap Javadoc for the detailed semanatics on behavior and performance.

add

Void add(ConcurrentMap^K key, ConcurrentMap^V val)

Add a value by key, raise exception if key was already mapped

clear

Void clear()

Remove all the key/value pairs

containsKey

Bool containsKey(ConcurrentMap^K key)

Return true if the specified key is mapped

each

Void each(Func<Void,ConcurrentMap^V,ConcurrentMap^K> f)

Iterate the map's key value pairs

eachWhile

Obj? eachWhile(Func<Obj?,ConcurrentMap^V,ConcurrentMap^K> f)

Iterate the map's key value pairs until given function returns non-null and return that as the result of this method. Otherwise itereate every pair and return null

get

@Operator
ConcurrentMap^V? get(ConcurrentMap^K key)

Get a value by its key or return null

getOrAdd

ConcurrentMap^V getOrAdd(ConcurrentMap^K key, ConcurrentMap^V defVal)

Get the value for the specified key, or if it doesn't exist then automatically add it with the given default value.

isEmpty

Bool isEmpty()

Return if size is zero (this is expensive and requires full segment traveral)

keys

List<ConcurrentMap^K> keys()

Return list of keys

make

new make(Int initialCapacity := 256)

Make with initial capacity

remove

ConcurrentMap^V? remove(ConcurrentMap^K key)

Remove a value by key, ignore if key not mapped

set

@Operator
Void set(ConcurrentMap^K key, ConcurrentMap^V val)

Set a value by key

setAll

This setAll(Map<ConcurrentMap^K,ConcurrentMap^V> m)

Append the specified map to this map be setting every key/value from m in this map. Keys in m not yet mapped are added and keys already mapped are overwritten. Return this.

size

Int size()

Return size (this is expensive and requires full segment traveral)

toStr

virtual override Str toStr()

vals

List<ConcurrentMap^V> vals()

Return list of values