Removing Duplicate Values from ArrayList

后端 未结 18 1324
无人及你
无人及你 2020-11-30 03:24

I have one Arraylist of String and I have added Some Duplicate Value in that. and i just wanna remove that Duplicate value So how to remove it.

Here Example I got o

18条回答
  •  忘掉有多难
    2020-11-30 03:47

    Using java 8:

    public static  List removeDuplicates(List list) {
        return list.stream().collect(Collectors.toSet()).stream().collect(Collectors.toList());
    }
    

提交回复
热议问题