Last active
December 30, 2020 19:21
-
-
Save yrashish/473df57aa49c2e533f0af13386a46344 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<Employee> employees = Arrays.asList(new Employee(1, "Ashish", 28, 10000) | |
, new Employee(2, "Ajay", 29, 1000) | |
, new Employee(3, "Abhishek", 29, 10000)); | |
Map<Integer, String> map = employees | |
.stream() | |
.collect(Collectors.toMap(Employee::getId, Employee::getName)); | |
Map<Long, List<Employee>> listMap = employees | |
.stream() | |
.collect(Collectors.groupingBy(Employee::getSalary)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment