Hi,

I am using ES6 by transpiling. The features remind me of Java lambdas.

If I have a string 'mainn' then my map should contain this.

[a=1, i=1, m=1, n=2]

Java : Example. I may not need the TreeMap here.

String s  = "__mainn__".replaceAll("[^a-z\\s]", "");


final Map<Character, Integer> count = s.chars().
        map(Character::toLowerCase).
        collect(TreeMap::new, (m, c) -> m.merge((char) c, 1, Integer::sum), 
Map::putAll);

What could be the es6 equivalent ?

Thanks,
Mohan
This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to