The same code cycled through a List can be cycled for a Set also.
Example:
import java.util.*;
class demo
{
public static void main(String[] args){
ArrayList
al.add("abcd");
al.add("kjhh");
al.add("kkhf");
al.add("cdfbg");
al.add("actfd");
Iterator it=al.iterator();
while(it.hasNext()){
System.out.println(it.next());
}}};
No comments:
Post a Comment