Answers for "how to split an element of a arraylist in java"

1

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");
      // creating Spliterator of ArrayList and using spliterator() method
      Spliterator<String> iterate = al.spliterator();
      System.out.println("ArrayList of colors: ");
      // forEachRemaining method of Spliterator
      iterate.forEachRemaining((n) -> System.out.println(n));
   }
}
Posted by: Guest on October-28-2020

Code answers related to "how to split an element of a arraylist in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language