Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

iterator for array java

import java.util.Arrays;
import java.util.Iterator;

public class ArrayToIterable {
   public static void main(String args[]){
      Integer[] myArray = {897, 56, 78, 90, 12, 123, 75};
      Iterator<Integer> iterator = Arrays.stream(myArray).iterator();
      while(iterator.hasNext()) {
         System.out.println(iterator.next());
      }
   }
}
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #iterator #array #java
ADD COMMENT
Topic
Name
2+3 =