ConcurrentLinkedDeque Spliterator() method in Java with Examples Last Updated : 27 Dec, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report The spliterator() method of ConcurrentLinkedDeque returns a Spliterator on the elements of ConcurrentLinkedDeque. The returned iterator is weakly consistent. Spliterator can be used with Streams in Java 8. Spliterator can traverse elements individually and in bulk too. Syntax: public Spliterator spliterator() Returns: This method returns a Spliterator over the elements in ConcurrentLinkedDeque. Below programs illustrate spliterator() method of ConcurrentLinkedDeque: Program 1: Java // Java Program to demonstrate spliterator() // method of ConcurrentLinkedDeque import java.util.concurrent.ConcurrentLinkedDeque; import java.util.*; public class GFG { public static void main(String[] args) { // create object of ConcurrentLinkedDeque ConcurrentLinkedDeque<Integer> CBD = new ConcurrentLinkedDeque<Integer>(); // Add elements CBD.add(22); CBD.add(34); CBD.add(45); CBD.add(67); // create Spliterator of Deque // using spliterator() method Spliterator<Integer> numbers = CBD.spliterator(); // getExactSize of Spliterator System.out.println("Size of Spliterator : " + numbers.estimateSize()); System.out.println("list of Numbers:"); // forEachRemaining method of Spliterator numbers.forEachRemaining( (n) -> System.out.println(n)); } } Output: Size of Spliterator : 9223372036854775807 list of Numbers: 22 34 45 67 Program 2: Java // Java Program to demonstrate spliterator() // method of ConcurrentLinkedDeque import java.util.concurrent.ConcurrentLinkedDeque; import java.util.*; public class GFG { public static void main(String[] args) { // create object of ConcurrentLinkedDeque ConcurrentLinkedDeque<String> CBD = new ConcurrentLinkedDeque<String>(); // Add numbers to front of ConcurrentLinkedDeque CBD.add("Geeks"); CBD.add("forGeeks"); CBD.add("A"); CBD.add("Computer"); CBD.add("Portal"); // create Spliterator of Deque // using spliterator() method Spliterator<String> numbers = CBD.spliterator(); // getExactSize of Spliterator System.out.println("Size of Spliterator : " + numbers.estimateSize()); System.out.println("list of Strings:"); // forEachRemaining method of Spliterator numbers.forEachRemaining( (n) -> System.out.println(n)); } } Output: Size of Spliterator : 9223372036854775807 list of Strings: Geeks forGeeks A Computer Portal Comment More infoAdvertise with us Next Article Java Program to Implement ConcurrentLinkedDeque API M MerlynShelley Follow Improve Article Tags : Java Technical Scripter Java Programs Technical Scripter 2018 Java-Collections Java - util package Java-Functions Java-ConcurrentLinkedDeque +4 More Practice Tags : JavaJava-Collections Similar Reads Java Program to Implement ConcurrentLinkedDeque API ConcurrentLinkedDeque class in Java is an unbounded concurrent deque that stores its elements as linked nodes where each node contains the address of the previous as well as next nodes. It belongs to java.util.concurrent package. This class is a member of the Java Collections Framework. It also exte 3 min read Java Program to Implement ConcurrentLinkedQueue API The ConcurrentLinkedQueue class in Java is a part of the Java Collection Framework. It belongs to java.util.concurrent package. It was introduced in JDK 1.5. It is used to implement Queue with the help of LinkedList concurrently. It is an unbounded thread-safe implementation of Queue which inserts e 4 min read Priority Queue of Pair in Java with Examples Prerequisite: PriorityQueue, Pair javafx.util.Pair<K,V> class in Java is the combination of two different objects called Key and Value. It basically provides a way to store pair of two heterogeneous data items. Pair <K, V> pair = new Pair<>(K key, V value) PriorityQueue<E> is 3 min read How to Split a String in Java with Delimiter? In Java, the split() method of the String class is used to split a string into an array of substrings based on a specified delimiter. The best example of this is CSV (Comma Separated Values) files.Program to Split a String with Delimiter in JavaHere is a simple program to split a string with a comma 2 min read Java Program to Implement ArrayBlockingQueue API ArrayBlockingQueue class is a member of the Java Collection framework. ArrayBlockingQueue is a bounded blocking queue. The term bounded, means that the size of the Queue is fixed and cannot be changed. Any attempt to put element/elements into a full queue will lead to blocking operation. Similarly, 7 min read Split a Vector into Multiple Smaller Vectors in Java In the realm of Java programming, the manipulation of vectors is a common task. One particularly useful operation is splitting a vector into multiple smaller vectors. This article aims to provide a detailed guide on achieving this in Java, catering to both beginners and experienced developers. Prere 3 min read Like