• Post Reply Bookmark Topic Watch Topic
  • New Topic

PriorityBlockingQueue  RSS feed

Ranch Hand
Posts: 664
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

public boolean add(E e)

Inserts the specified element into this priority queue.


public PriorityBlockingQueue(int initialCapacity,
Comparator<? super E> comparator)

Creates a PriorityBlockingQueue with the specified initial capacity that orders its elements according to the specified comparator.

Sourced from here.

"The wildcard parameterized type Comparator<? super E> is the family of all instantiations of the Comparator interface for type argument types that are super types of E)"

Sourced and adapted from here.

Just to confirm my understanding, thus, PriorityBlockQueue can be initialized with any object that implements Comparator.

PublicBlockingQueue myqueue = new PriorityBlockingQueue(100, ???)

What does Comparator<? super E> imply?
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!