https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/BlockingQueue.html
BlockingQueue
methods come in four forms, with different ways of handling operations that cannot be satisfied immediately, but may be satisfied at some point in the future:
null
or false
, depending on the operation),Throws exception | Special value | Blocks | Times out | |
---|---|---|---|---|
Insert | add(e) |
offer(e) |
put(e) |
[offer(e, time, unit) ](https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/BlockingQueue.html#offer(E, long, java.util.concurrent.TimeUnit)) |
Remove | remove() |
[poll() ](https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/BlockingQueue.html#poll(long, java.util.concurrent.TimeUnit)) |
take() |
[poll(time, unit) ](https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/BlockingQueue.html#poll(long, java.util.concurrent.TimeUnit)) |
Examine | element() |
peek() |
not applicable | not applicable |