Java Code Examples for org.redisson.api.RBlockingDeque#offerFirst()
The following examples show how to use
org.redisson.api.RBlockingDeque#offerFirst() .
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: RedissonBlockingDequeTest.java From redisson with Apache License 2.0 | 5 votes |
@Test public void testOfferFirstLast() throws InterruptedException { RBlockingDeque<Integer> deque = redisson.getBlockingDeque("deque"); deque.offerFirst(1); deque.offerFirst(2); deque.offerLast(3); deque.offerLast(4); assertThat(deque).containsExactly(2, 1, 3, 4); }
Example 2
Source File: RedissonBlockingDequeTest.java From redisson with Apache License 2.0 | 5 votes |
@Test public void testTakeFirst() throws InterruptedException { RBlockingDeque<Integer> deque = redisson.getBlockingDeque("queue:take"); deque.offerFirst(1); deque.offerFirst(2); deque.offerLast(3); deque.offerLast(4); assertThat(deque.takeFirst()).isEqualTo(2); assertThat(deque.takeFirst()).isEqualTo(1); assertThat(deque.takeFirst()).isEqualTo(3); assertThat(deque.takeFirst()).isEqualTo(4); assertThat(deque.size()).isZero(); }
Example 3
Source File: RedissonBlockingDequeTest.java From redisson with Apache License 2.0 | 5 votes |
@Test public void testTakeLast() throws InterruptedException { RBlockingDeque<Integer> deque = redisson.getBlockingDeque("queue:take"); deque.offerFirst(1); deque.offerFirst(2); deque.offerLast(3); deque.offerLast(4); assertThat(deque.takeLast()).isEqualTo(4); assertThat(deque.takeLast()).isEqualTo(3); assertThat(deque.takeLast()).isEqualTo(1); assertThat(deque.takeLast()).isEqualTo(2); assertThat(deque.size()).isZero(); }