com.nostra13.universalimageloader.core.assist.deque
Class LIFOLinkedBlockingDeque<T>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractQueue<E>
          extended by com.nostra13.universalimageloader.core.assist.deque.LinkedBlockingDeque<T>
              extended by com.nostra13.universalimageloader.core.assist.deque.LIFOLinkedBlockingDeque<T>
All Implemented Interfaces:
BlockingDeque<T>, Deque<T>, Serializable, Iterable<T>, Collection<T>, BlockingQueue<T>, Queue<T>

public class LIFOLinkedBlockingDeque<T>
extends LinkedBlockingDeque<T>

LinkedBlockingDeque using LIFO algorithm

Since:
1.6.3
Author:
Sergey Tarasevich (nostra13[at]gmail[dot]com)
See Also:
Serialized Form

Constructor Summary
LIFOLinkedBlockingDeque()
           
 
Method Summary
 boolean offer(T e)
          Inserts the specified element at the front of this deque if it is possible to do so immediately without violating capacity restrictions, returning true upon success and false if no space is currently available.
 T remove()
          Retrieves and removes the first element of this deque.
 
Methods inherited from class com.nostra13.universalimageloader.core.assist.deque.LinkedBlockingDeque
add, addFirst, addLast, clear, contains, descendingIterator, drainTo, drainTo, element, getFirst, getLast, iterator, offer, offerFirst, offerFirst, offerLast, offerLast, peek, peekFirst, peekLast, poll, poll, pollFirst, pollFirst, pollLast, pollLast, pop, push, put, putFirst, putLast, remainingCapacity, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, size, take, takeFirst, takeLast, toArray, toArray, toString
 
Methods inherited from class java.util.AbstractQueue
addAll
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
addAll, containsAll, equals, hashCode, isEmpty, removeAll, retainAll
 

Constructor Detail

LIFOLinkedBlockingDeque

public LIFOLinkedBlockingDeque()
Method Detail

offer

public boolean offer(T e)
Inserts the specified element at the front of this deque if it is possible to do so immediately without violating capacity restrictions, returning true upon success and false if no space is currently available. When using a capacity-restricted deque, this method is generally preferable to the addFirst method, which can fail to insert an element only by throwing an exception.

Specified by:
offer in interface BlockingDeque<T>
Specified by:
offer in interface Deque<T>
Specified by:
offer in interface BlockingQueue<T>
Specified by:
offer in interface Queue<T>
Overrides:
offer in class LinkedBlockingDeque<T>
Parameters:
e - the element to add
Returns:
true if the element was added to this deque, else false
Throws:
ClassCastException - if the class of the specified element prevents it from being added to this deque
NullPointerException - if the specified element is null
IllegalArgumentException - if some property of the specified element prevents it from being added to this deque

remove

public T remove()
Retrieves and removes the first element of this deque. This method differs from pollFirst only in that it throws an exception if this deque is empty.

Specified by:
remove in interface BlockingDeque<T>
Specified by:
remove in interface Deque<T>
Specified by:
remove in interface Queue<T>
Overrides:
remove in class LinkedBlockingDeque<T>
Returns:
the head of this deque
Throws:
NoSuchElementException - if this deque is empty


Copyright © 2011-2014. All Rights Reserved.