Answers for "example of iterator interface in java"

2

iterable interface in java

List<String> list = new ArrayList><();

list.add("one");
list.add("two");
list.add("three");

Iterator<String> iterator = list.iterator();

while(iterator.hasNext()) {
    String element = iterator.next();
    System.out.println( element );
}
Posted by: Guest on September-10-2021

Code answers related to "example of iterator interface in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language