Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

get intersection of two lists java

Set<String> result = list.stream()  .distinct()  .filter(otherList::contains)  .collect(Collectors.toSet()); Set<String> commonElements = new HashSet(Arrays.asList("red", "green")); Assert.assertEquals(commonElements, result);
Comment

PREVIOUS NEXT
Code Example
Java :: sorting collections with comparator java 
Java :: spring convert page to list 
Java :: simple for loop 
Java :: java string vers int 
Java :: initialize arraylist java with size 
Java :: how to get string input line in java 
Java :: java get element occurrences in a list java 
Java :: final vs static keyword in java 
Java :: int x = 3 & 5 
Java :: how to declare jtextfield 
Java :: and roid shape setCornerRadii 
Java :: java static variable 
Java :: app "restart" the home activity (and dismiss all other activities). 
Java :: could not find java; set JAVA_HOME or ensure java is in PATH 
Java :: call fragment method from activity 
Java :: android studio hide linearlayout 
Java :: neither bindingresult nor plain target object for bean name spring mvc 
Java :: locked screen android studio 
Java :: rename action bar android 
Java :: give ram to java 
Java :: horizontal recyclerview item width half of screen android 
Java :: arraylist<hashmap<string, string arraylist = new arraylist<() 
Java :: java new string 
Java :: arc() method from the processing library 
Java :: Java No-Arg Constructors 
Java :: 7877777777777777777777777 
Java :: spring boot embedded tomcat port already in use 
Java :: méthode retourne nom classe java 
Java :: Java read in 
Java :: stringbuilder with delimiter java 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =