You may try this employees.stream().collect(Collectors.groupingBy(x->x.salary)).entrySet().forEach(x->{ System.out.println(x.getKey()+" "+x.getValue()); });