// Java Program to Illustrate remove() Method
// in PriorityQueue
// Where Elements are of String Type
// Importing all utility classes
import java.util.*;
// Main class
// PriorityQueueDemo
public class GFG {
// Main driver method
public static void main(String args[])
{
// Creating an empty PriorityQueue
// where elements are of string type
PriorityQueue<String> queue
= new PriorityQueue<String>();
// Adding elements into the Queue
// using add() method
queue.add("Welcome");
queue.add("To");
queue.add("Geeks");
queue.add("For");
queue.add("Geeks");
// Printing the elements of PriorityQueue
System.out.println("Initial PriorityQueue: "
+ queue);
// Removing elements from PriorityQueue
// using remove() method
queue.remove("Geeks");
queue.remove("For");
queue.remove("Welcome");
// Displaying the PriorityQueue
// after removal of element
System.out.println("PriorityQueue after removing "
+ "elements: " + queue);
}
}