Question: Hello so far this is what i have done

```
class Ideone{

    public static void main (String[] args) throws java.lang.Exception{

        Person p1 = new Person("person1");
        Person p2 = new Person("person1");
        Person [] array = new Person[]{p1, p2};

        String name_to_test = "person1";

        System.out.println(Arrays.toString(Arrays.stream(array).filter(x -> x.name.equals(name_to_test)).toArray()));

    }
}

class Person{

    public String name;

    public Person(String name){
        this.name = name;
    }

}

```

but i get 

[Person@1ab7765, Person@128cdfa] while i want to return them by the same name which i filter them.

Any ideas?

Answer: 
You should `map()` every filtered `Person` to its corresponding name:

```
Arrays.stream(array)
      .map(Person::getName)
      .filter(name_to_test::equals)
      .toArray();

```

Of course, you have to make sure that there is a getter method for `name` in `Person`:

```
class Person {
    public String name;

    public Person(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }
}

```
You have missed to override `toString` method in class.

```
class Person{

    public String name;

    public Person(String name){
        this.name = name;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                '}';
    }
}

```

Now the output is: `[Person{name='person1'}, Person{name='person1'}]`