Question: I have two ArrayLists of different size.

```
ArrayList<String> names = new ArrayList<String>();
ArrayList<User> users = new ArrayList<User>();

```

User is an Object with attributes name and address. I want to get the addresses where the names of the User object stored in ArrayList users is the same as the names stored in the ArrayList names.

Is this possible? If so, how?

Answer: 
You can use Java 8. 

Please try:

```
users.stream().filter(u -> names.contains(u.getName())).map(
                u -> "Name: " + u.getName() + ", address: " + u. getAddress()).forEach(System.out::println);

```
You need to iterate over the users-list and check for every element if it is contained in names. You might want to use a Set instead of a list for names if you have alot of elements in there.