set generics code example
Example 1: declare generic set java
Set<String> set = new HashSet<String>;
Iterator<String> iterator = set.iterator();
while(iterator.hasNext()){
String aString = iterator.next();
}
Example 2: declare generic set java
Set<String> set = new HashSet<String>;
for(String aString : set) {
System.out.println(aString);
}