![]() |
In this article, we will demonstrate how to check if a Priority Queue is empty or not. The java.util.PriorityQueue.isEmpty() method is used to check if the Priority Queue is empty or not. Based on the Boolean value it returns the Response for the same. Syntax: Priority_Queue.isEmpty()
Parameters: There is no need to pass any parameter inside the function. Return Value: The method returns a boolean value, ie. True if Priority Queue is empty else false. Program to Check if a PriorityQueue is EmptyThe below programs illustrate the Java.util.PriorityQueue.isEmpty() method: Example 1:The program showing that the PriorityQueue is not Empty: Java
Output
false Example 2:The program showing that the PriorityQueue is Empty: Java
Output
true |
Reffered: https://www.geeksforgeeks.org
Java |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 17 |