A RetroSearch Logo

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

Search Query:

Showing content from https://www.w3resource.com/java-tutorial/util/arraydeque/java_arraydeque_isempty.php below:

Website Navigation


Java ArrayDeque Class: isEmpty() Method

Java ArrayDeque Class: isEmpty() MethodLast update on August 19 2022 21:51:24 (UTC/GMT +8 hours) public boolean isEmpty()

Returns true if this deque contains no elements.

Package: java.util

Java Platform: Java SE 8

Syntax:

isEmpty()

Return Value:

true if this deque contains no elements

Return Value Type:boolean

Pictorial Presentation:

Example: Java ArrayDeque Class: isEmpty() Method

import java.util.ArrayDeque;
import java.util.Deque;

public class Main {
   public static void main(String[] args) {
   
   // Create an empty array deque with an initial capacity.
      Deque<Integer> deque = new ArrayDeque(8);

    // Test whether the Deque is empty or not.
        if (deque.isEmpty())
        {
            System.out.println("The ArrayDeque is empty.");
        }
        else
        {
            System.out.println("The ArrayDeque is not empty.");
        }
    }
}

Output:

The ArrayDeque is empty.

Java Code Editor:

Previous:getLast Method
Next:iterator Method




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