Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java remove duplicates from list by field

List<Obj> list = ...; // list contains multiple objects
Collection<Obj> nonDuplicateCollection = list.stream()
        .collect(Collectors.toMap(Obj::generateUniqueKey, Function.identity(), (a, b) -> a))
        .values();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #remove #duplicates #list #field
ADD COMMENT
Topic
Name
9+3 =