summaryrefslogtreecommitdiff
path: root/java/10-collections/Test5Set.java
blob: 8f182c46f0f7c177f33c9bbfdf7f2b5644abc60b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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<Customer> customers = new HashSet<Customer>();
		
		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);
		}
	}
}