package org.synyx.urlaubsverwaltung.core.mail;

import org.springframework.util.StringUtils;
import org.synyx.urlaubsverwaltung.core.person.Person;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;


/**
 * @author  Aljona Murygina - murygina@synyx.de
 */
final class RecipientUtil {

    private RecipientUtil() {

        // HIDDEN
    }

    static List<String> getMailAddresses(Person... persons) {

        return getMailAddresses(Arrays.asList(persons));
    }


    static List<String> getMailAddresses(List<Person> persons) {

        return persons.stream().filter(person -> StringUtils.hasText(person.getEmail())).map(person ->
                    person.getEmail()).collect(Collectors.toList());
    }
}

@@ -190,23 +190,31 @@
 l.List;%0A
+%0A
 import 
+static 
 java.uti
@@ -232,16 +232,23 @@
 llectors
+.toList
 ;%0A%0A%0A/**%0A
@@ -609,16 +609,29 @@
 stream()
+%0A            
 .filter(
@@ -683,22 +683,8 @@
 ()))
-.map(person -%3E
 %0A   
@@ -696,31 +696,29 @@
     
-        p
+.map(P
 erson
-.
+::
 getEmail
 ()).
@@ -717,31 +717,31 @@
 mail
-()).collect(Collectors.
+)%0A            .collect(
 toLi

use method reference