Skip to content

Instantly share code, notes, and snippets.

@tomblench
Created March 8, 2018 12:22
Show Gist options
  • Save tomblench/e01256efe319dfd21c9020bae10e9f69 to your computer and use it in GitHub Desktop.
Save tomblench/e01256efe319dfd21c9020bae10e9f69 to your computer and use it in GitHub Desktop.
public class Guff {
public static void doit() {
ArrayList<String> list = new ArrayList<String>();
list.add("bob");
list.add("rita");
list.add("sue");
list.add("rita");
System.out.println(dedup(list));
}
public static <T> List<T> dedup(List<T> list) {
Set<T> set = new HashSet<T>(list);
return new ArrayList<T>(set);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment