Queue
Queue
- classesLinkedList
PriorityQueue
poll()
- remove front elementpeek()
- get front elementadd()
- add new element in endremove(item)
- remove element from front, or aitem
size()
// traversing elements
Queue<String> pq = new PriorityQueue<>();
pq.add("Geeks");
pq.add("For");
pq.add("Geeks");
Iterator iterator = pq.iterator();
while (iterator.hasNext()) {
System.out.print(iterator.next() + " ");
}