使用 Guava 去掉 List 中的重复内容

如何去掉 List 中的重复内容?

可以使用下面的方法去掉重复的内容

ImmutableSet.copyOf(list).asList()

有下面的代码片段:

if (imageURLList != null && imageURLList.size() > 0) { imageURLList = ImmutableSet.copyOf(imageURLList).asList(); }

将重复的内容去掉。