list)
Here you can find the source of uniqueList(Collection
list)
Parameter | Description |
---|---|
list | a parameter |
public static <P> Collection<P> uniqueList(Collection<P> list)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Collection; public class Main { /**/*from ww w. j av a 2 s. c om*/ * Remove all duplicated entries. * * @param list * @return */ public static <P> Collection<P> uniqueList(Collection<P> list) { ArrayList<P> uniqueList = new ArrayList<>(); for (P item : list) { if (uniqueList.contains(item)) { continue; } uniqueList.add(item); } return uniqueList; } }