Skip to content

Instantly share code, notes, and snippets.

@BlackTrenchCoat
Last active October 11, 2015 15:19
public static Map<Character, Integer> signature(String s) {
Map<Character, Integer> result = new HashMap<Character, Integer>();
s.chars().forEach((int i) -> {
char c = Character.toChars(i)[0];
Integer count = result.get(c);
if ( count == null) {
result.put(c, 1);
} else {
result.put(c, count+1);
}
});
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment