Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<Integer> input = Arrays.asList(1, 2, 3, 4, 2, 4, 5, 8, 2);
- List<Integer> result = input
- .stream()
- .filter(x -> input.stream().filter(x::equals).count() > 1)
- .distinct()
- .collect(Collectors.toList());
Add Comment
Please, Sign In to add comment