Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; public class Main { /** * Brute force, for when HashSet and TreeSet won't work (e.g. #hashCode * implementation isn't appropriate). The original Collection is not * modified. */ public static Collection removeDuplicates(Collection original) { ArrayList result = new ArrayList(); for (Iterator i = original.iterator(); i.hasNext();) { Object item = i.next(); if (!result.contains(item)) { result.add(item); } } return result; } }