Package uk.ac.starlink.vo

## Class LinkedBlockingStack<E>

- java.lang.Object
- - java.util.AbstractCollection<E>
  - - java.util.AbstractQueue<E>
    - - uk.ac.starlink.vo.LinkedBlockingStack<E>

- All Implemented Interfaces:
    `java.lang.Iterable<E>`, `java.util.Collection<E>`, `java.util.concurrent.BlockingQueue<E>`, `java.util.Queue<E>`

      public class LinkedBlockingStack<E>
      extends java.util.AbstractQueue<E>
      implements java.util.concurrent.BlockingQueue<E>

  An unbounded LIFO BlockingQueue. Implemented as a simple singly-linked list protected by a ReentrantLock, with a Condition to manage waiting for elements in take().

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `LinkedBlockingStack​()` |
    `LinkedBlockingStack​(java.util.Collection c)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `clear​()` |
    `boolean` | `contains​(java.lang.Object o)` |
    `int` | `drainTo​(java.util.Collection c)` |
    `int` | `drainTo​(java.util.Collection c, int max)` |
    `protected java.util.concurrent.locks.ReentrantLock` | `getLock​()` | Returns the lock object used for synchronizing this object's state.
    `java.util.Iterator<E>` | `iterator​()` |
    `boolean` | `offer​(E o)` |
    `boolean` | `offer​(E o, long t, java.util.concurrent.TimeUnit unit)` |
    `E` | `peek​()` |
    `E` | `poll​()` |
    `E` | `poll​(long t, java.util.concurrent.TimeUnit unit)` |
    `void` | `put​(E o)` |
    `int` | `remainingCapacity​()` |
    `boolean` | `remove​(java.lang.Object o)` |
    `int` | `size​()` |
    `E` | `take​()` |

    - ### Methods inherited from class java.util.AbstractCollection

      `containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString`

    - ### Methods inherited from class java.util.AbstractQueue

      `add, addAll, element, remove`

    - ### Methods inherited from interface java.util.concurrent.BlockingQueue

      `add`

    - ### Methods inherited from interface java.util.Collection

      `addAll, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.util.Queue

      `element, remove`

- - ### Constructor Detail

    - #### LinkedBlockingStack

          public LinkedBlockingStack​()

    - #### LinkedBlockingStack

          public LinkedBlockingStack​(java.util.Collection c)

  - ### Method Detail

    - #### getLock

          protected java.util.concurrent.locks.ReentrantLock getLock​()

      Returns the lock object used for synchronizing this object's state.

    - #### size

          public int size​()

      Specified by:
        `size` in interface `java.util.Collection<E>`
      Specified by:
        `size` in class `java.util.AbstractCollection<E>`

    - #### offer

          public boolean offer​(E o)

      Specified by:
        `offer` in interface `java.util.concurrent.BlockingQueue<E>`
      Specified by:
        `offer` in interface `java.util.Queue<E>`

    - #### put

          public void put​(E o)

      Specified by:
        `put` in interface `java.util.concurrent.BlockingQueue<E>`

    - #### offer

          public boolean offer​(E o,
                               long t,
                               java.util.concurrent.TimeUnit unit)

      Specified by:
        `offer` in interface `java.util.concurrent.BlockingQueue<E>`

    - #### peek

          public E peek​()

      Specified by:
        `peek` in interface `java.util.Queue<E>`

    - #### take

          public E take​()
                 throws java.lang.InterruptedException

      Specified by:
        `take` in interface `java.util.concurrent.BlockingQueue<E>`
      Throws:
        `java.lang.InterruptedException`

    - #### poll

          public E poll​()

      Specified by:
        `poll` in interface `java.util.Queue<E>`

    - #### poll

          public E poll​(long t,
                        java.util.concurrent.TimeUnit unit)
                 throws java.lang.InterruptedException

      Specified by:
        `poll` in interface `java.util.concurrent.BlockingQueue<E>`
      Throws:
        `java.lang.InterruptedException`

    - #### remainingCapacity

          public int remainingCapacity​()

      Specified by:
        `remainingCapacity` in interface `java.util.concurrent.BlockingQueue<E>`

    - #### contains

          public boolean contains​(java.lang.Object o)

      Specified by:
        `contains` in interface `java.util.concurrent.BlockingQueue<E>`
      Specified by:
        `contains` in interface `java.util.Collection<E>`
      Overrides:
        `contains` in class `java.util.AbstractCollection<E>`

    - #### remove

          public boolean remove​(java.lang.Object o)

      Specified by:
        `remove` in interface `java.util.concurrent.BlockingQueue<E>`
      Specified by:
        `remove` in interface `java.util.Collection<E>`
      Overrides:
        `remove` in class `java.util.AbstractCollection<E>`

    - #### clear

          public void clear​()

      Specified by:
        `clear` in interface `java.util.Collection<E>`
      Overrides:
        `clear` in class `java.util.AbstractQueue<E>`

    - #### drainTo

          public int drainTo​(java.util.Collection c)

      Specified by:
        `drainTo` in interface `java.util.concurrent.BlockingQueue<E>`

    - #### drainTo

          public int drainTo​(java.util.Collection c,
                             int max)

      Specified by:
        `drainTo` in interface `java.util.concurrent.BlockingQueue<E>`

    - #### iterator

          public java.util.Iterator<E> iterator​()

      Specified by:
        `iterator` in interface `java.util.Collection<E>`
      Specified by:
        `iterator` in interface `java.lang.Iterable<E>`
      Specified by:
        `iterator` in class `java.util.AbstractCollection<E>`

Copyright © 2018 Central Laboratory of the Research Councils. All Rights Reserved.