Created
March 8, 2018 12:22
-
-
Save tomblench/e01256efe319dfd21c9020bae10e9f69 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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