Question: I have two ArrayLists (list1 & list2). I would like to see if any 1 (or more) of the objects in list2(which are strings) occur in list1.

So, for some examples:

```
List<String> list1 = Arrays.asList("ABCD", "EFGH", "IJKL", "QWER");
List<String> list2 = Arrays.asList("ABCD", "1234");
//Should result in true, because "ABCD" is in list 1 & 2

```

However, the method containsAll() does not work in this use case, as `1234` does not occur in list1, and will result in a result of false, also contains() does not work.

Besides writing my own implementation(comparing all of the values individually from list2 to list1), is there a similar method to contains(), where a list of strings can be passed in, and compare that to another list, and return true if one or more values are contained in that list?

**More Examples:**

```
ArrayList list1 = {1, 2, 3, 4, 5}

ArrayList list2 = {1, 2, 3} --> True
ArrayList list2 = {3, 2, 1} --> True
ArrayList list2 = {5, 6, 7, 8, 9} --> True
ArrayList list2 = {6, 7, 8, 9} --> False

```

Answer: 
Like `list2.stream().anyMatch(list1::contains)` in java 8.
There's no need to use streams for this task. Use the [`Collections.disjoint`](https://docs.oracle.com/javase/9/docs/api/java/util/Collections.html#disjoint-java.util.Collection-java.util.Collection-) method instead:

```
boolean result = !Collections.disjoint(list1, list2);

```

According to the docs:

> 
> Returns `true` if the two specified collections have no elements in common.
> 
> 
>