1.

What Is Priorityblockingqueue In Java Concurrency?

Answer»

PriorityBlockingQueue class implements the BlockingQueue INTERFACE. The elements of the PriorityBlockingQueue are ordered according to their natural ordering, or by a COMPARATOR PROVIDED at queue construction time, depending on which of the following CONSTRUCTOR is used.

  • PriorityBlockingQueue() - Creates a PriorityBlockingQueue with the default initial capacity (11) that orders its elements according to their natural ordering.
  • PriorityBlockingQueue(int initialCapacity, Comparator<? super E> comparator) - Creates a PriorityBlockingQueue with the SPECIFIED initial capacity that orders its elements according to the specified comparator.

PriorityBlockingQueue class implements the BlockingQueue interface. The elements of the PriorityBlockingQueue are ordered according to their natural ordering, or by a Comparator provided at queue construction time, depending on which of the following constructor is used.



Discussion

No Comment Found