ConcurrentLinkedDeque size() method in Java Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The size() method of ConcurrentLinkedDeque class in Java is used to find the number of elements present in the ConcurrentLinkedDeque container. In other words, this method tells the current capacity of the container. The value returned by this method is of integral type and in case if the container container more elements than the maximum value of an integer then this method returns the max value of integer i.e., Integer.MAX_VALUE. Syntax: ConcurrentLinkedDeque.size() Parameters: This method doesn't accepts any parameter.Return Value: This method returns an integral value which is the current size of the ConcurrentLinkedDeque container.Below program illustrates size() method of ConcurrentLinkedDeque: Java // Java Program to demonstrate the // size of ConcurrentLinkedDeque import java.util.concurrent.*; class ConcurrentLinkedDequeDemo { public static void main(String[] args) { // Create a ConcurrentLinkedDeque // using ConcurrentLinkedDeque() constructor ConcurrentLinkedDeque<Integer> cld = new ConcurrentLinkedDeque<Integer>(); // Adding elements to the collection cld.addFirst(12); cld.addFirst(70); cld.addFirst(1009); cld.addFirst(475); // Displaying the ConcurrentLinkedDeque System.out.println("ConcurrentLinkedDeque: " + cld); // Calculate size int size = cld.size(); System.out.println("Size of the collection is: " + size); } } Output: ConcurrentLinkedDeque: [475, 1009, 70, 12] Size of the collection is: 4 Note: Unlike for other collections in Java, this method does not perform the size calculation operation for ConcurrentLinkedDeque in constant time because of the asynchronous nature of these deques and it is possible for the size to change during execution of this method, in which case the returned result will be inaccurate. This method is typically not very useful in concurrent applications.Reference: https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentLinkedDeque.html#size() Comment More infoAdvertise with us Next Article ConcurrentLinkedDeque equals() method in Java with Example S saigopalCheela Follow Improve Article Tags : Java Practice Tags : Java Similar Reads ConcurrentLinkedQueue size() method in Java The size() method of ConcurrentLinkedQueue is used to returns number of elements that this ConcurrentLinkedQueue contains. Syntax: public int size() Returns: This method number of elements in this ConcurrentLinkedQueue. Below programs illustrate size() method of ConcurrentLinkedQueue: Example 1: Jav 2 min read ConcurrentLinkedDeque in Java The ConcurrentLinkedDeque class in Java is a part of the Java Collection Framework and implements the Collection interface and the AbstractCollection class. It belongs to java.util.concurrent package. It is used to implement Deque with the help of LinkedList concurrently.Iterators and spliterators a 10 min read ConcurrentLinkedDeque in Java The ConcurrentLinkedDeque class in Java is a part of the Java Collection Framework and implements the Collection interface and the AbstractCollection class. It belongs to java.util.concurrent package. It is used to implement Deque with the help of LinkedList concurrently.Iterators and spliterators a 10 min read ConcurrentSkipListSet size() method in Java The java.util.concurrent.ConcurrentSkipListSet.size() method is an in-built function in Java which gives the total count of the elements present in the set. Syntax: ConcurrentSkipListSet.size() Parameters: The function does not accept any parameter. Return Value: The function returns the number of e 2 min read ConcurrentLinkedDeque equals() method in Java with Example The equals() method of java.util.ConcurrentLinkedDeque class is used to compare the specified object with this ConcurrentLinkedDeque for equality. Returns true if and only if the specified object is also a ConcurrentLinkedDeque, both ConcurrentLinkedDeques have the same size, and all corresponding p 2 min read ConcurrentHashMap size() Method in Java The size() method in Java's ConcurrentHashMap class is used to retrieve the number of key-value mappings in the map. It has the following signature: int size() The size() method works in a concurrent environment, which means that it can be called from multiple threads without causing any data race o 2 min read Like