001package edu.pdx.cs410J.java8;
002
003import java.util.Iterator;
004import java.util.List;
005import java.util.function.Consumer;
006
007public class InternalIteration {
008
009  public void evolutionOfIteration(String[] arrayOfStrings, List<String> listOfStrings) {
010    for (int i = 0; i < arrayOfStrings.length; i++) {
011      String string = arrayOfStrings[i];
012      System.out.println(string);
013    }
014
015    Iterator<String> iter = listOfStrings.iterator();
016    while(iter.hasNext()) {
017      String string = iter.next();
018      System.out.println(string);
019    }
020
021    for(String string : listOfStrings) {
022      System.out.println(string);
023    }
024
025    listOfStrings.forEach(new Consumer<String>() {
026      @Override
027      public void accept(String string) {
028        System.out.print(string);
029      }
030    });
031
032    listOfStrings.forEach(System.out::println);
033  }
034}