(T e)
| 42 | } |
| 43 | |
| 44 | @Override |
| 45 | public synchronized boolean offer(T e) { |
| 46 | //接口描述表明,offer 只能因容量原因而失败,但我们是因唯一性原因而失败。 |
| 47 | if (mElementSet.contains(e)) { |
| 48 | return false; |
| 49 | } |
| 50 | |
| 51 | |
| 52 | if (mBlockingQueue.offer(e)) { |
| 53 | mElementSet.add(e); |
| 54 | return true; |
| 55 | } |
| 56 | return false; |
| 57 | } |
| 58 | |
| 59 | @Override |
| 60 | public synchronized boolean offer(T e, long timeout, TimeUnit unit) throws InterruptedException { |
no test coverage detected