import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; public class Test5Set { /** * @param args */ public static void main(String[] args) { Set customers = new HashSet(); customers.add(new Customer("Nuwan")); customers.add(new Customer("Lasitha")); customers.add(new Customer("Praveen")); Customer y = new Customer("ABC"); Customer z = new Customer("ABC"); customers.add(y); customers.add(y); customers.add(z); for (Customer c : customers) { // Do some work with c here System.out.println(c); } } }