I want to compare if any of the objects in a list2 is present in a list1.
I could iterate over both lists and compare all elements using .contains() but I am wondering if there is not a more efficient way. I found this and I am trying to implement the suggested method:
List<Item> list1;
List<Item> list2;
boolean anyMatch = list1.stream().anyMatch(x -> x.equals(list2.stream()));
System.out.println(anyMatch);
When I do this I constantly get false, even when I'd expect a true. How come?