Wondering is there more simple way than computing the character count of a given string as below?
String word = \"AAABBB\"; Map ch
Hope this help : Java 8 Stream & Collector:
String word = "AAABBB"; Map charCount = word.chars().boxed().collect(Collectors.toMap( k -> Character.valueOf((char) k.intValue()), v -> 1, Integer::sum)); System.out.println(charCount); Output: {A=3, B=3}