Answers for "list with unique values java"

1

java get distinct values from list

List<String> distinctElements = list.stream()
                        .distinct()
                        .collect(Collectors.toList());
Posted by: Guest on January-17-2021
0

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());
Posted by: Guest on July-17-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language