Java Code Examples for java.util.concurrent.PriorityBlockingQueue#offer()
The following examples show how to use
java.util.concurrent.PriorityBlockingQueue#offer() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PriorityBlockingQueueTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Offer of non-Comparable throws CCE */ public void testOfferNonComparable() { PriorityBlockingQueue q = new PriorityBlockingQueue(1); try { q.offer(new Object()); shouldThrow(); } catch (ClassCastException success) { assertTrue(q.isEmpty()); assertEquals(0, q.size()); assertNull(q.poll()); } }
Example 2
Source File: PriorityBlockingQueueTest.java From j2objc with Apache License 2.0 | 5 votes |
/** * Offer of non-Comparable throws CCE */ public void testOfferNonComparable() { PriorityBlockingQueue q = new PriorityBlockingQueue(1); try { q.offer(new Object()); q.offer(new Object()); shouldThrow(); } catch (ClassCastException success) {} }