Class DelegatingBlockingQueue<T>

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(T obj)  
      int drainTo​(Collection4<T> list)
      Removes all the available elements in the queue to the colletion passed as argument.
      boolean hasNext()  
      Iterator4 iterator()  
      T next()  
      T next​(long timeout)
      Returns the next queued item or waits for it to be available for the maximum of timeout miliseconds.
      T nextMatching​(Predicate4<T> condition)
      Returns the next object in the queue that matches the specified condition.
      void stop()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DelegatingBlockingQueue

        public DelegatingBlockingQueue​(BlockingQueue4<T> queue)
    • Method Detail

      • next

        public T next()
        Specified by:
        next in interface Queue4<T>
      • add

        public void add​(T obj)
        Specified by:
        add in interface Queue4<T>
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface Queue4<T>
      • nextMatching

        public T nextMatching​(Predicate4<T> condition)
        Description copied from interface: Queue4
        Returns the next object in the queue that matches the specified condition. The operation is always NON-BLOCKING.
        Specified by:
        nextMatching in interface Queue4<T>
        Parameters:
        condition - the object must satisfy to be returned
        Returns:
        the object satisfying the condition or null if none does
      • drainTo

        public int drainTo​(Collection4<T> list)
        Description copied from interface: BlockingQueue4

        Removes all the available elements in the queue to the colletion passed as argument.

        It will block until at least one element is available.

        Specified by:
        drainTo in interface BlockingQueue4<T>
        Returns:
        the number of elements added to the list.