@Test public void shouldFailToPoll() { assertNull(queue.poll()); }
public E poll() { E value = null; final Node<E> head = this.head; Node<E> next = head.next; if (null != next) { value = next.value; next.value = null; head.nextOrdered(null); if (null == next.next) { final Node<E> tail = this.tail; if (tail == next && casTail(tail, empty)) { next = empty; } } headOrdered(next); } return value; }
ManyToOneConcurrentLinkedQueue extends ManyToOneConcurrentLinkedQueueHead<E> implements Queue<E> { public E poll() { E value = null; final Node<E> head = this.head; Node<E> next = head.next; if (null != next) { value = next.value; next.value = null; head.nextOrdered(null); if (null == next.next) { final Node<E> tail = this.tail; if (tail == next && casTail(tail, empty)) { next = empty; } } headOrdered(next); } return value; } }
ManyToOneConcurrentLinkedQueue extends ManyToOneConcurrentLinkedQueueHead<E> implements Queue<E> { public E poll() { E value = null; final Node<E> head = this.head; Node<E> next = head.next; if (null != next) { value = next.value; next.value = null; head.nextOrdered(null); if (null == next.next) { final Node<E> tail = this.tail; if (tail == next && casTail(tail, empty)) { next = empty; } } headOrdered(next); } return value; } ManyToOneConcurrentLinkedQueue(); }
ManyToOneConcurrentLinkedQueue extends ManyToOneConcurrentLinkedQueueHead<E> implements Queue<E> { public E poll() { E value = null; final Node<E> head = this.head; Node<E> next = head.next; if (null != next) { value = next.value; next.value = null; head.nextOrdered(null); if (null == next.next) { final Node<E> tail = this.tail; if (tail == next && casTail(tail, empty)) { next = empty; } } headOrdered(next); } return value; } ManyToOneConcurrentLinkedQueue(); boolean add(final E e); boolean offer(final E e); E remove(); E poll(); E element(); E peek(); int size(); boolean isEmpty(); boolean contains(final Object o); Iterator<E> iterator(); Object[] toArray(); T[] toArray(final T[] a); boolean remove(final Object o); boolean containsAll(final Collection<?> c); boolean addAll(final Collection<? extends E> c); boolean removeAll(final Collection<?> c); boolean retainAll(final Collection<?> c); void clear(); String toString(); }
ManyToOneConcurrentLinkedQueue extends ManyToOneConcurrentLinkedQueueHead<E> implements Queue<E> { public E poll() { E value = null; final Node<E> head = this.head; Node<E> next = head.next; if (null != next) { value = next.value; next.value = null; head.nextOrdered(null); if (null == next.next) { final Node<E> tail = this.tail; if (tail == next && casTail(tail, empty)) { next = empty; } } headOrdered(next); } return value; } ManyToOneConcurrentLinkedQueue(); boolean add(final E e); boolean offer(final E e); E remove(); E poll(); E element(); E peek(); int size(); boolean isEmpty(); boolean contains(final Object o); Iterator<E> iterator(); Object[] toArray(); T[] toArray(final T[] a); boolean remove(final Object o); boolean containsAll(final Collection<?> c); boolean addAll(final Collection<? extends E> c); boolean removeAll(final Collection<?> c); boolean retainAll(final Collection<?> c); void clear(); String toString();  }