I'm checking some simple Lambda expressions and I have found in the internet the following example, which is supposed to work.

Unfortunatelly, it seems NetBeans 8.0.1 does not like the code in line `(Person p) -> p.getAge() < 18)` and `.map((Person p) -> p.getName())`

The error **"Incompatible parameter types in lambda expression"** is shown.

Anybody has an Idea how can I correct the problem?

```
public class Lambda {

    private enum Gender {

        MALE, FEMALE
    };

    public static class Person {

        private final String name;
        private final int age;
        private final Gender gender;

        public Person(String name, int age, Gender gender) {
            this.name = name;
            this.age = age;
            this.gender = gender;
        }

        public String getName() {
            return name;
        }

        public int getAge() {
            return age;
        }

        public Gender getGender() {
            return gender;
        }

    }

    public static void main(String[] args) {

        List<Person> persons = new ArrayList<>();
        persons.add(new Person("angelo", 50, Lambda.Gender.MALE));
        persons.add(new Person("paolo", 10, Lambda.Gender.MALE));
        persons.add(new Person("giuseppe", 5, Lambda.Gender.MALE));
        persons.add(new Person("andrea", 22, Lambda.Gender.FEMALE));
        persons.add(new Person("guglielmo", 2, Lambda.Gender.FEMALE));

        printNames(persons, 
                (Person p) -> p.getAge() < 18);

    }

    private static void printNames(List<Person> persons, Predicate predicate) {

        persons.stream()
                .filter(predicate)
                .map((Person p) -> p.getName())
                .sorted()
                .forEach(name -> System.out.println(name));

    }

}

```