Skip to content

Instantly share code, notes, and snippets.

@soeirosantos
Created December 25, 2016 16:18
Show Gist options
  • Save soeirosantos/913036f5b6c7ce0aacfdfc2eb23eafb0 to your computer and use it in GitHub Desktop.
Save soeirosantos/913036f5b6c7ce0aacfdfc2eb23eafb0 to your computer and use it in GitHub Desktop.
Integer[] array = {1, 1, 1, 2, 2, 2, 4, 4, 1, 1, 2, 5, 5,};
Map<Integer, Long> collect =
Arrays.stream(array).collect(
Collectors.groupingBy(Function.identity(), Collectors.counting()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment