A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/java/concurrentlinkeddeque-isempty-method-in-java-with-examples/ below:

ConcurrentLinkedDeque isEmpty() method in Java with Examples

ConcurrentLinkedDeque isEmpty() method in Java with Examples

Last Updated : 11 Jul, 2025

The

java.util.concurrent.ConcurrentLinkedDeque.isEmpty()

is an in-built function in Java which checks whether the deque contains elements or not.

Syntax:
public boolean isEmpty()
Parameters:

The function does not accepts any parameter.

Return:

This method returns a

boolean value

stating whether this deque is empty or not. Below programs illustrate the ConcurrentLinkedDeque.isEmpty() method:

Example: 1 Java
// Java Program Demonstrate
// isEmpty() method of ConcurrentLinkedDeque

import java.util.concurrent.*;

class ConcurrentLinkedDequeDemo {
    public static void main(String[] args)
    {
        ConcurrentLinkedDeque<String> cld
            = new ConcurrentLinkedDeque<String>();

        // Displaying the existing LinkedDeque
        System.out.println("ConcurrentLinkedDeque: "
                           + cld);

        // Check if the queue is empty
        // using isEmpty() method
        System.out.println("Is deque empty: "
                           + cld.isEmpty());
    }
}
Output:
ConcurrentLinkedDeque: []
Is deque empty: true
Example: 2 Java
// Java Program Demonstrate
// isEmpty() method of ConcurrentLinkedDeque

import java.util.concurrent.*;

class ConcurrentLinkedDequeDemo {
    public static void main(String[] args)
    {
        ConcurrentLinkedDeque<String> cld
            = new ConcurrentLinkedDeque<String>();

        cld.add("GFG");
        cld.add("Gfg");
        cld.add("GeeksforGeeks");
        cld.add("Geeks");

        // Displaying the existing LinkedDeque
        System.out.println("ConcurrentLinkedDeque: "
                           + cld);

        // Check if the queue is empty
        // using isEmpty() method
        System.out.println("Is deque empty: "
                           + cld.isEmpty());
    }
}
Output:
ConcurrentLinkedDeque: [GFG, Gfg, GeeksforGeeks, Geeks]
Is deque empty: false


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4