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