I have a List of 'Client' objects each one with a field "email".
I need something like:
List<String> listEmails = clients.stream().map(client->client.getEmail())
.collect(Collectors.toList());
...but returning directly a String[]
.
Is there a proper way to map a List<Client>
to a String[] listEmails
using Java 8 streams?