PriorityBlockingQueue
2016-11-01 23:42
190 查看
The
Read the
the interface.
The
All elements inserted into the
Notice that the
Also notice, that in case you obtain an
Here is an example of how to use the
PriorityBlockingQueueclass implements the
BlockingQueueinterface.
Read the
BlockingQueuetext for more information about
the interface.
The
PriorityBlockingQueueis an unbounded concurrent queue. It uses the same ordering rules as the
java.util.PriorityQueueclass. You cannot insert null into this queue.
All elements inserted into the
PriorityBlockingQueuemust implement the
java.lang.Comparableinterface. The elements thus order themselves according to whatever priority you decide in your
Comparableimplementation.
Notice that the
PriorityBlockingQueuedoes not enforce any specific behaviour for elements that have equal priority (compare() == 0).
Also notice, that in case you obtain an
Iteratorfrom a
PriorityBlockingQueue, the
Iteratordoes not guarantee to iterate the elements in priority order.
Here is an example of how to use the
PriorityBlockingQueue:
BlockingQueue queue = new PriorityBlockingQueue(); //String implements java.lang.Comparable queue.put("Value"); String value = queue.take();
相关文章推荐
- PriorityBlockingQueue
- PriorityBlockingQueue 简单实用例子
- 并发队列-无界阻塞优先级队列PriorityBlockingQueue原理探究
- PriorityBlockingQueue
- PriorityBlockingQueue详解
- 使用PriorityBlockingQueue进行任务按优先级同步执行,摘自Think in Java
- JUC源码分析19-队列-PriorityBlockingQueue
- Java多线程之新类库中的构件PriorityBlockingQueue
- 使用优先队列PriorityBlockingQueue进行消息调度
- JAVA并发编程随笔【一】PriorityBlockingQueue优先级队列
- 阻塞queue系列之PriorityBlockingQueue
- Java并发学习(二十四)-PriorityBlockingQueue分析
- 并发队列-无界阻塞优先级队列PriorityBlockingQueue原理探究
- JAVA并发编程随笔【一】PriorityBlockingQueue优先级队列
- JDK并发工具类源码学习系列——PriorityBlockingQueue
- 源码分析-PriorityBlockingQueue
- JAVA并发编程随笔【一】PriorityBlockingQueue优先级队列
- Java 多线程 优先级队列 PriorityBlockingQueue
- java点滴之阻塞队列:PriorityBlockingQueue,SynchronousQueue,LinkedBlockingQueue,ArrayBlockingQueue
- JAVA并发编程随笔【一】PriorityBlockingQueue优先级队列