Online Java Compiler By
JavaTpoint.com
import java.util.LinkedList; import java.util.List; import java.util.Spliterator; public class JavaListSpliteratorExample1 { public static void main(String[] args) { List
list = new LinkedList<>(); for (int i=1;i<=10;i++) { list.add(i); } System.out.print("Values : "); //spliterator split and then iterate the split parts in parallel Spliterator
str = list.spliterator(); // if the specified element exists then the tryAdvance() will perform the given action while(str.tryAdvance((n)->System.out.print(n+" "))); } }
Output