📅  最后修改于: 2022-03-11 14:52:31.734000             🧑  作者: Mango
static List 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 employeeNames = employeeList
.stream()
.collect(Collectors.mapping(Employee::getName, Collectors.toList()));