Код: Выделить всё
Employee employee[] = {new Employee(1,"Sunny"),new Employee(2,"king")};
List list1 =Arrays.asList(employee);
Stream s2 = list1.stream();
s2.forEach(n ->System.out.println(n.name));
list1.stream().forEach(n ->System.out.println(n.name)) // work here
которая присутствует в классе «Сотрудник»
Подробнее здесь: https://stackoverflow.com/questions/790 ... rom-stream
Мобильная версия