Question: I'm getting to know the lambda syntax and have come to something that tickles my mind:

```
private ArrayList<Person> list = new ArrayList<>();

public void remove(Person person){
    this.list.remove(person);
}

public void run(){

    list.stream().filter(p -> p.getAge() > 15).forEach(p -> p.setAge(p.getAge() + 1));

    list.stream().filter(p -> p.getAge() > 15).forEach(PersonDatabase::remove);; //Syntax error

}

```

When I try to remove objects using the last line of code, I get an error saying the method is not static. Why can't I refer to the class I'm already in, but when I use `Person::getName` which also is not static, it works fine?

Answer: 
> 
> Why can't I refer to the class I'm already in?
> 
> 
> 

If `remove` is non-static it needs a receiver (an object to call the method on).

If this code is inside `PersonDatabase`, you should use this syntax: `this::remove`.

> 
> but when I use `Person::getName` which also is not static, it works fine?
> 
> 
> 

This is because `p -> p.getName()` is (pretty much) equivalent to `Person::getName`. The argument `p` is automatically chosen as receiver for the call to `Person::getName`.

In other words, both this variant

```
/* Static Person method */ static void method(Person p) { ... }

```

and this variant

```
/* Non-static Person method */ void method() { ... }

```

can be used as `Person::method` when iterating over `Person` objects. In the former case, `p` will be passed as argument, in the latter case `p` will be used as receiver.
`PersonDatabase::remove` has two arguments - one implicit - the current `PersonDatabase` instance, and the other explicit - the passed `Person` instance.

Therefore you can't use this method reference where only a single `Person` instance is available. When you change your remove method to be static, you eliminate the implicit `PersonDatabase` argument, leaving you with a single `Person` argument, which causes your method to match the parameter expected by `forEach`.