Java ArrayDeque Class: isEmpty() Method
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
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/java-tutorial/util/arraydeque/java_arraydeque_isempty.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics