Answers for "Collectors.mapping"

0

java collectors mapping

static List<Employee> employeeList
      = Arrays.asList(new Employee("Tom Jones", 45, 15000.00),
      new Employee("Harry Andrews", 45, 7000.00),
      new Employee("Ethan Hardy", 65, 8000.00),
      new Employee("Nancy Smith", 22, 10000.00),
      new Employee("Deborah Sprightly", 29, 9000.00));
 
  public static void main(String[] args) {
    List<String> employeeNames = employeeList
        .stream()
        .collect(Collectors.mapping(Employee::getName, Collectors.toList()));
Posted by: Guest on August-23-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language