2
public class FetchVarableList {
public static void main(String[] args) {
Employee e1 = new Employee(1, "Abi", "Fin", 2000);
Employee e2 = new Employee(2, "Chandu", "OPs", 5000);
Employee e3 = new Employee(3, "mahesh", "HR", 8000);
Employee e4 = new Employee(4, "Suresh", "Main", 1000);
List<Employee> empList = new ArrayList<>();
empList.add(e1); empList.add(e2); empList.add(e3); empList.add(e4);
List<String> emps = empList.stream().map(p -> p.getEmpName())
.collect(Collectors.toList());
emps.forEach(System.out::println);
}
}
프로그래밍에 대한이 잘 작동하지만 내가이 수중 음파 탐지기 위반이, 에서는 람다 식으로 변경하려면? 나는 구현이 정확하지만, 대신 메서드 참조를 사용 할 수 있습니다소나 위반 오징어 : S1612
.map (Employee :: getEmpName) –
감사합니다. –