/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.stream.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
List<String> list = new ArrayList<String>();
list.add("a");
list.add("b");
list.add("c");
list.add("d");
list.add("b");
list.add("c");
list.add("a");
list.add("a");
list.add("a");
Map
<String, Long
> counted
= list.
stream().
collect(Collectors.
groupingBy(e
-> e, Collectors.
counting()));
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CmltcG9ydCBqYXZhLnV0aWwuc3RyZWFtLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCUxpc3Q8U3RyaW5nPiBsaXN0ID0gbmV3IEFycmF5TGlzdDxTdHJpbmc+KCk7CgkJbGlzdC5hZGQoImEiKTsKCQlsaXN0LmFkZCgiYiIpOwoJCWxpc3QuYWRkKCJjIik7CgkJbGlzdC5hZGQoImQiKTsKCQlsaXN0LmFkZCgiYiIpOwoJCWxpc3QuYWRkKCJjIik7CgkJbGlzdC5hZGQoImEiKTsKCQlsaXN0LmFkZCgiYSIpOwoJCWxpc3QuYWRkKCJhIik7CgkJCgkJTWFwPFN0cmluZywgTG9uZz4gY291bnRlZCA9IGxpc3Quc3RyZWFtKCkuY29sbGVjdChDb2xsZWN0b3JzLmdyb3VwaW5nQnkoZSAtPiBlLCBDb2xsZWN0b3JzLmNvdW50aW5nKCkpKTsKCQoJCVN5c3RlbS5vdXQucHJpbnRsbihjb3VudGVkKTsKCX0KfQ==