java collectors mapping

Solutions on MaxInterview for java collectors mapping by the best coders in the world

showing results for - "java collectors mapping"
Tim
14 Sep 2020
1  static List<Employee> employeeList
2      = Arrays.asList(new Employee("Tom Jones", 45, 15000.00),
3      new Employee("Harry Andrews", 45, 7000.00),
4      new Employee("Ethan Hardy", 65, 8000.00),
5      new Employee("Nancy Smith", 22, 10000.00),
6      new Employee("Deborah Sprightly", 29, 9000.00));
7 
8  public static void main(String[] args) {
9    List<String> employeeNames = employeeList
10        .stream()
11        .collect(Collectors.mapping(Employee::getName, Collectors.toList()));