Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java find if element of list in present in another list

list1.stream()
   .map(Object1::getProperty)
   .anyMatch(
     list2.stream()
       .map(Object2::getProperty)
       .collect(toSet())
       ::contains)

// Example with predicate
Predicate<Object> notInList1 = object -> list1.stream().noneMatch(object::equals);
List<Object> missingInList1 = list2.stream().filter(notInList1).collect(Collectors.toList());
Comment

PREVIOUS NEXT
Code Example
Java :: java instanceof keyword 
Java :: for cicle java 
Java :: arrays.copy 2d array 
Java :: write in text file android studio 
Java :: android java get value from listview item 
Java :: cast java 
Java :: multiplication table using while loop in java 
Java :: synchronized block java 
Java :: java write to a file 
Java :: greatest element in array in java 
Java :: convert void * to int 
Java :: android get last crash adb 
Java :: arraylist to string 
Java :: spring boot dockerfile 
Java :: how to use do while loop in java 
Java :: java leap years 
Java :: rider find and replace 
Java :: basic java programs 
Java :: binary to int java 
Java :: check if user has internet connection in kotlin 
Java :: phone number format java 
Java :: JFrame frame = new JFrame (); 
Java :: convert calendar to date java 
Java :: string palindrome in java 
Java :: regex double quote java 
Java :: add int to list java 
Java :: java check if int 
Java :: deserialize list jackson 
Java :: final vs static keyword in java 
Java :: R8: java.lang.OutOfMemoryError: GC overhead limit exceeded react-native 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =