![]() remove ( Object o): A single instance of the mentioned element will be removed from the queue.ġ1. In case no elements are present, null will be returned.ġ0. p oll(): Head of the PriorityQueue will be retrieved and removed. In case no elements are present, null will be returned.ĩ. peek (): Head of the PriorityQueue will be retrieved, not removed. offer ( E e): Mentioned element e will be inserted in the queue.Ĩ. iterator (): The iterator that is used over the elements in the queue will be returned.ħ. contains ( Object o): If the queue contains the mentioned element o, true will be returned.Ħ. If natural ordering is used, null will be returned.ĥ. ![]() comparator (): Comparator that is used to sort the queue will be returned. clear (): All the elements in the PriorityQueue will be removed.Ĥ. size(): Count of elements in the collection will be returned.ģ. add(E e): Element e will be added to the PriorityQueue on calling this method.Ģ. Now, let us see some of the commonly used methods in Java PriorityQueue:ġ. PriorityQueue ( SortedSet c): A PriorityQueue will be created with elements in the mentioned sorted set. PriorityQueue ( PriorityQueue c): A PriorityQueue will be created with elements in the mentioned PriorityQueue.Ħ. Moreover, the elements are ordered based on the mentioned comparator.ĥ. PriorityQueue(int ic, Comparator comparator): A PriorityQueue will be created with the initial capacity ic mentioned. Moreover, the elements are ordered based on natural ordering.Ĥ. PriorityQueue (int ic): A PriorityQueue will be created with the initial capacity ic mentioned. PriorityQueue ( Collection c): A PriorityQueue will be created with elements in the mentioned collection.ģ. Moreover, the elements are ordered based on natural ordering.Ģ. ![]() PriorityQueue (): A PriorityQueue will be created with 11 as its initial capacity is in default. Public class PriorityQueue extends AbstractQueue implements Serializable Constructors of Java PriorityQueueįollowing are the constructors that are commonly used in Java PriorityQueue:ġ.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |