Write a Java Program to Count the Occurrences of Each Character in String code example
Example: count occurrences of character in string java 8
String someString = "elephant";
long count = someString.chars().filter(ch -> ch == 'e').count();
assertEquals(2, count);
long count2 = someString.codePoints().filter(ch -> ch == 'e').count();
assertEquals(2, count2);