Online Java Compiler By
JavaTpoint.com
import java.util.Collection; import java.util.Spliterator; import java.util.concurrent.ConcurrentLinkedQueue; public class JavaCollectionSpliteratorExample3 { static int i=1; public static void main(String[] args) { Collection
collection = new ConcurrentLinkedQueue(); for (char i='A';i<='Z';i++) { collection.add(i); } System.out.print("Values : "); //spliterator split and iterate the split parts in parallel Spliterator
str = collection.spliterator(); // if element exists tryAdvance() will perform action while(str.tryAdvance((n)->System.out.print(n+" "))); } }
Output