-
Notifications
You must be signed in to change notification settings - Fork 0
/
PQTest.java
36 lines (24 loc) · 932 Bytes
/
PQTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package qcollection;
import java.util.*;
//import java.util.PriorityQueue;
public class PQTest {
public static void main(String[] args) {
HiLoPriorityQueue<Customer> prq = new HiLoPriorityQueue<Customer>(10);
HiLoPriorityQueue<Customer> hlq = new HiLoPriorityQueue<Customer>(10,5);
Customer c1 = new Customer("Rock",999);
Customer c2 = new Customer("Brock",1);
Customer c3 = new Customer("UnderTaker",1000);
// insert values in the queue
hlq.add(c1);
hlq.add(c2);
hlq.add(c3);
Customer c = hlq.remove();
System.out.println("Customer removed from queue information :: "+c.toString());
Iterator<Customer> itr = hlq.iterator();
System.out.println("Looping through all the current elements of the queue :: ");
while(itr.hasNext()) {
Customer element = itr.next();
System.out.println("Details :: " + element.toString());
}
}
}