groupByString


Description:

public static HashMap<string,ArrayList<string>> groupByString (ArrayList<string> list, owned MapFunc<string,string> keyFn)

Groups elements by a key extracted from each element.

Example:

    var groups = Lists.groupByString (words, (w) => {
return w.substring (0, 1);
});
// groups["a"] = ["apple", "avocado"]

Parameters:

list

the source list.

keyFn

the key extraction function.

Returns:

a HashMap of key to grouped list.