Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

filtering out unique values from a list in java

ArrayList<String> listWithDuplicateValues = new ArrayList<>();
list.add("first");
list.add("first");
list.add("second");

ArrayList uniqueList = (ArrayList) listWithDuplicateValues.stream().distinct().collect(Collectors.toList());
Comment

PREVIOUS NEXT
Code Example
Java :: how to find a word in string in java 
Java :: reentrantlock java 
Java :: how to print to the console in java 
Java :: java convert java.util.Date to LocalDate 
Java :: Java Create LinkedList in Java 
Java :: cannot find symbol variable log 
Java :: java date format with timezone 
Java :: android get distance between two locations kotlin 
Java :: How to determine if a graph contains a cycle, in Java? 
Java :: java button size 
Java :: str.substring last 2 java 
Java :: javafx change textfield background color 
Java :: java replaceAll ignore case 
Java :: maven paper 
Java :: remove first and last character from string in java 
Java :: java subscript numbers 
Java :: retainall java 
Java :: how to make a loop in java 
Java :: remove duplicates from sorted array 
Java :: how to return array in java 
Java :: intent in java 
Java :: java declare a list 
Java :: worldedit api paste schematic 
Java :: setbackground java 
Java :: how to find length of array in java 
Java :: hello world program in java 
Java :: heap in java 
Java :: what is packages in java 
Java :: android canvas line thickness 
Java :: check if char is a space java 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =