java.lang.Object
org.jtrim2.concurrent.collections.TerminableQueues
Defines factory methods for
TerminableQueue.
This class cannot be instantiated or inherited.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TerminableQueue<T>withWrappedQueue(ReservablePollingQueue<T> queue) Returns aTerminableQueueusing the givenReservablePollingQueueto store elements.
-
Method Details
-
withWrappedQueue
Returns aTerminableQueueusing the givenReservablePollingQueueto store elements. The returnedTerminableQueuetakes ownership of the passedReservablePollingQueue, and so the calling code may no longer use the passed queue.Note: The passed queue does not need to be empty when passed, in which case of course, the returned
TerminableQueuewill start out with the initial elements of the passedReservablePollingQueue.- Type Parameters:
T- the type of the elements of the created queue- Parameters:
queue- the backing queue which the returnedTerminableQueuewill use. Thus, the element order of the returnedTerminableQueueis the same as the givenReservablePollingQueue- Returns:
- a
TerminableQueueusing the givenReservablePollingQueueto store elements. This method never returnsnull.
-