I have the following qustion:
How can I convert the following code snipped to Java 8 lambda style?
List<String> tmpAdresses = new ArrayList<String>();
for (User user : users) {
tmpAdresses.add(user.getAdress());
}
Have no idea and started with the following:
List<String> tmpAdresses = users.stream().map((User user) -> user.getAdress());
String
just add.collect(Collectors.toList())
tomap(...)
. – Dacosta(User user) -> user.getAddress()
can be written asuser -> user.getAddress()
or justUser::getAddress
– Escent