This is a common need in day to day programming. Removing duplicates from a list. A easy and nice way I found here
public static <T> void removeDuplicate(List <T> list) { HashSet <T> h = new HashSet<T>(list); list.clear(); list.addAll(h); }
No comments:
Post a Comment