to_map


Description:


public Collector<Map<K,V>,Object,G> to_map<K,V,G> (owned MapFunc<K,G> key_mapper, owned MapFunc<V,G> val_mapper, owned CombineFunc<V>? merger = null, owned HashDataFunc<K>? key_hash = null, owned EqualDataFunc<K>? key_equal = null, owned EqualDataFunc<V>? value_equal = null)

Returns a collector that accumulates the elements into a new map.

If there are key duplications, the values are merged using the merger function, or throws a MapError.DUPLICATE_KEY if the function is not specified.

There are no guarantees on the type, mutability, or thread-safety of the map.

Parameters:

key_mapper

a mapping function for keys

val_mapper

a mapping function for values

merger

a function used to resolve key collisions. if not specified, (a, b) => { throw new MapError.DUPLICATE_KEY(...); } is used.

key_hash

a hash function for keys. if not specified, Gee.Functions.get_hash_func_for is used to get a proper function

key_equal

an equal function for keys. if not specified, Gee.Functions.get_equal_func_for is used to get a proper function

value_equal

an equal function for values. if not specified, Gee.Functions.get_equal_func_for is used to get a proper function

Returns:

the collector implementation


Namespace: Gpseq.Collectors
Package: gpseq-1.0