arraylist spliterator code example
Example: ArrayList spliterator() method in java
import java.util.ArrayList;
import java.util.Spliterator;
public class ArrayListSpliteratorMethodExample
{
public static void main(String[] args)
{
ArrayList<String> al = new ArrayList<String>();
al.add("red");
al.add("blue");
al.add("green");
al.add("yellow");
al.add("orange");
Spliterator<String> iterate = al.spliterator();
System.out.println("ArrayList of colors: ");
iterate.forEachRemaining((n) -> System.out.println(n));
}
}