I have the following qustion:
How can I convert the following code snipped to Java 8 lambda style?
List tmpAdresses = new ArrayList
You need to collect
your stream into a List:
List adresses = users.stream()
.map(User::getAdress)
.collect(Collectors.toList());
For more information on the different Collectors
visit the documentation
User::getAdress
is just another form of writing (User user) -> user.getAdress()
which could aswell be written as user -> user.getAdress()
(because the type User
will be inferred by the compiler)