Stream toArray(IntFunction generator) example Description Stream toArray(IntFunction<A[]> generator) returns an array containing the elements of this stream, using the provided generator function. import java.util.List; import java.time.LocalDate; import java.time.Month; import java.util.Arrays; public class Main { public static void main(String[] args) { List<Employee> persons = Employee.persons(); Employee[] men = persons.stream() .filter(p -> p.getGender() ==Gender.MALE) .toArray(Employee[]::new); for(Employee employee: men){…