Liking cljdoc? Tell your friends :D

jdk.util.concurrent.LinkedBlockingDeque

An optionally-bounded java.util.concurrent.blocking deque based on linked nodes.

The optional capacity bound constructor argument serves as a way to prevent excessive expansion. The capacity, if unspecified, is equal to Integer.MAX_VALUE. Linked nodes are dynamically created upon each insertion unless this would bring the deque above capacity.

Most operations run in constant time (ignoring time spent blocking). Exceptions include remove, removeFirstOccurrence, removeLastOccurrence, contains, iterator.remove(), and the bulk operations, all of which run in linear time.

This class and its iterator implement all of the optional methods of the Collection and Iterator interfaces.

This class is a member of the

Java Collections Framework.

An optionally-bounded java.util.concurrent.blocking deque based on
linked nodes.

The optional capacity bound constructor argument serves as a
way to prevent excessive expansion. The capacity, if unspecified,
is equal to Integer.MAX_VALUE.  Linked nodes are
dynamically created upon each insertion unless this would bring the
deque above capacity.

Most operations run in constant time (ignoring time spent
blocking).  Exceptions include remove,
removeFirstOccurrence, removeLastOccurrence, contains, iterator.remove(), and the bulk
operations, all of which run in linear time.

This class and its iterator implement all of the
optional methods of the Collection and Iterator interfaces.

This class is a member of the

Java Collections Framework.
raw docstring

->linked-blocking-dequeclj

(->linked-blocking-deque)
(->linked-blocking-deque capacity)

Constructor.

Creates a LinkedBlockingDeque with the given (fixed) capacity.

capacity - the capacity of this deque - int

throws: java.lang.IllegalArgumentException - if capacity is less than 1

Constructor.

Creates a LinkedBlockingDeque with the given (fixed) capacity.

capacity - the capacity of this deque - `int`

throws: java.lang.IllegalArgumentException - if capacity is less than 1
raw docstring

addclj

(add this e)

Inserts the specified element at the end of this deque unless it would violate capacity restrictions. When using a capacity-restricted deque, it is generally preferable to use method offer.

This method is equivalent to addLast(E).

e - the element to add - E

returns: true (as specified by Collection.add(E)) - boolean

throws: java.lang.IllegalStateException - if this deque is full

Inserts the specified element at the end of this deque unless it would
 violate capacity restrictions.  When using a capacity-restricted deque,
 it is generally preferable to use method offer.

 This method is equivalent to addLast(E).

e - the element to add - `E`

returns: true (as specified by Collection.add(E)) - `boolean`

throws: java.lang.IllegalStateException - if this deque is full
raw docstring

add-firstclj

(add-first this e)

Description copied from interface: BlockingDeque

e - the element to add - E

throws: java.lang.IllegalStateException - if this deque is full

Description copied from interface: BlockingDeque

e - the element to add - `E`

throws: java.lang.IllegalStateException - if this deque is full
raw docstring

add-lastclj

(add-last this e)

Description copied from interface: BlockingDeque

e - the element to add - E

throws: java.lang.IllegalStateException - if this deque is full

Description copied from interface: BlockingDeque

e - the element to add - `E`

throws: java.lang.IllegalStateException - if this deque is full
raw docstring

clearclj

(clear this)

Atomically removes all of the elements from this deque. The deque will be empty after this call returns.

Atomically removes all of the elements from this deque.
The deque will be empty after this call returns.
raw docstring

containsclj

(contains this o)

Returns true if this deque contains the specified element. More formally, returns true if and only if this deque contains at least one element e such that o.equals(e).

o - object to be checked for containment in this deque - java.lang.Object

returns: true if this deque contains the specified element - boolean

Returns true if this deque contains the specified element.
 More formally, returns true if and only if this deque contains
 at least one element e such that o.equals(e).

o - object to be checked for containment in this deque - `java.lang.Object`

returns: true if this deque contains the specified element - `boolean`
raw docstring

descending-iteratorclj

(descending-iterator this)

Returns an iterator over the elements in this deque in reverse sequential order. The elements will be returned in order from last (tail) to first (head).

The returned iterator is weakly consistent.

returns: an iterator over the elements in this deque in reverse order - java.util.Iterator<E>

Returns an iterator over the elements in this deque in reverse
 sequential order.  The elements will be returned in order from
 last (tail) to first (head).

 The returned iterator is
 weakly consistent.

returns: an iterator over the elements in this deque in reverse order - `java.util.Iterator<E>`
raw docstring

drain-toclj

(drain-to this c)
(drain-to this c max-elements)

Description copied from interface: BlockingQueue

c - the collection to transfer elements into - java.util.Collection max-elements - the maximum number of elements to transfer - int

returns: the number of elements transferred - int

throws: java.lang.UnsupportedOperationException - if addition of elements is not supported by the specified collection

Description copied from interface: BlockingQueue

c - the collection to transfer elements into - `java.util.Collection`
max-elements - the maximum number of elements to transfer - `int`

returns: the number of elements transferred - `int`

throws: java.lang.UnsupportedOperationException - if addition of elements is not supported by the specified collection
raw docstring

elementclj

(element this)

Retrieves, but does not remove, the head of the queue represented by this deque. This method differs from peek only in that it throws an exception if this deque is empty.

This method is equivalent to getFirst.

returns: the head of the queue represented by this deque - E

throws: java.util.NoSuchElementException - if this deque is empty

Retrieves, but does not remove, the head of the queue represented by
 this deque.  This method differs from peek only in that
 it throws an exception if this deque is empty.

 This method is equivalent to getFirst.

returns: the head of the queue represented by this deque - `E`

throws: java.util.NoSuchElementException - if this deque is empty
raw docstring

get-firstclj

(get-first this)

Description copied from interface: Deque

returns: the head of this deque - E

throws: java.util.NoSuchElementException - if this deque is empty

Description copied from interface: Deque

returns: the head of this deque - `E`

throws: java.util.NoSuchElementException - if this deque is empty
raw docstring

get-lastclj

(get-last this)

Description copied from interface: Deque

returns: the tail of this deque - E

throws: java.util.NoSuchElementException - if this deque is empty

Description copied from interface: Deque

returns: the tail of this deque - `E`

throws: java.util.NoSuchElementException - if this deque is empty
raw docstring

iteratorclj

(iterator this)

Returns an iterator over the elements in this deque in proper sequence. The elements will be returned in order from first (head) to last (tail).

The returned iterator is weakly consistent.

returns: an iterator over the elements in this deque in proper sequence - java.util.Iterator<E>

Returns an iterator over the elements in this deque in proper sequence.
 The elements will be returned in order from first (head) to last (tail).

 The returned iterator is
 weakly consistent.

returns: an iterator over the elements in this deque in proper sequence - `java.util.Iterator<E>`
raw docstring

offerclj

(offer this e)
(offer this e timeout unit)

Description copied from interface: BlockingDeque

e - the element to add - E timeout - how long to wait before giving up, in units of unit - long unit - a TimeUnit determining how to interpret the timeout parameter - java.util.concurrent.TimeUnit

returns: true if the element was added to this deque, else false - boolean

throws: java.lang.NullPointerException - if the specified element is null

Description copied from interface: BlockingDeque

e - the element to add - `E`
timeout - how long to wait before giving up, in units of unit - `long`
unit - a TimeUnit determining how to interpret the timeout parameter - `java.util.concurrent.TimeUnit`

returns: true if the element was added to this deque, else
         false - `boolean`

throws: java.lang.NullPointerException - if the specified element is null
raw docstring

offer-firstclj

(offer-first this e)
(offer-first this e timeout unit)

Description copied from interface: BlockingDeque

e - the element to add - E timeout - how long to wait before giving up, in units of unit - long unit - a TimeUnit determining how to interpret the timeout parameter - java.util.concurrent.TimeUnit

returns: true if successful, or false if the specified waiting time elapses before space is available - boolean

throws: java.lang.NullPointerException - if the specified element is null

Description copied from interface: BlockingDeque

e - the element to add - `E`
timeout - how long to wait before giving up, in units of unit - `long`
unit - a TimeUnit determining how to interpret the timeout parameter - `java.util.concurrent.TimeUnit`

returns: true if successful, or false if
         the specified waiting time elapses before space is available - `boolean`

throws: java.lang.NullPointerException - if the specified element is null
raw docstring

offer-lastclj

(offer-last this e)
(offer-last this e timeout unit)

Description copied from interface: BlockingDeque

e - the element to add - E timeout - how long to wait before giving up, in units of unit - long unit - a TimeUnit determining how to interpret the timeout parameter - java.util.concurrent.TimeUnit

returns: true if successful, or false if the specified waiting time elapses before space is available - boolean

throws: java.lang.NullPointerException - if the specified element is null

Description copied from interface: BlockingDeque

e - the element to add - `E`
timeout - how long to wait before giving up, in units of unit - `long`
unit - a TimeUnit determining how to interpret the timeout parameter - `java.util.concurrent.TimeUnit`

returns: true if successful, or false if
         the specified waiting time elapses before space is available - `boolean`

throws: java.lang.NullPointerException - if the specified element is null
raw docstring

peekclj

(peek this)

Description copied from interface: BlockingDeque

returns: the head of this deque, or null if this deque is empty - E

Description copied from interface: BlockingDeque

returns: the head of this deque, or null if this deque is empty - `E`
raw docstring

peek-firstclj

(peek-first this)

Description copied from interface: Deque

returns: the head of this deque, or null if this deque is empty - E

Description copied from interface: Deque

returns: the head of this deque, or null if this deque is empty - `E`
raw docstring

peek-lastclj

(peek-last this)

Description copied from interface: Deque

returns: the tail of this deque, or null if this deque is empty - E

Description copied from interface: Deque

returns: the tail of this deque, or null if this deque is empty - `E`
raw docstring

pollclj

(poll this)
(poll this timeout unit)

Description copied from interface: BlockingDeque

timeout - how long to wait before giving up, in units of unit - long unit - a TimeUnit determining how to interpret the timeout parameter - java.util.concurrent.TimeUnit

returns: the head of this deque, or null if the specified waiting time elapses before an element is available - E

throws: java.lang.InterruptedException - if interrupted while waiting

Description copied from interface: BlockingDeque

timeout - how long to wait before giving up, in units of unit - `long`
unit - a TimeUnit determining how to interpret the timeout parameter - `java.util.concurrent.TimeUnit`

returns: the head of this deque, or null if the
         specified waiting time elapses before an element is available - `E`

throws: java.lang.InterruptedException - if interrupted while waiting
raw docstring

poll-firstclj

(poll-first this)
(poll-first this timeout unit)

Description copied from interface: BlockingDeque

timeout - how long to wait before giving up, in units of unit - long unit - a TimeUnit determining how to interpret the timeout parameter - java.util.concurrent.TimeUnit

returns: the head of this deque, or null if the specified waiting time elapses before an element is available - E

throws: java.lang.InterruptedException - if interrupted while waiting

Description copied from interface: BlockingDeque

timeout - how long to wait before giving up, in units of unit - `long`
unit - a TimeUnit determining how to interpret the timeout parameter - `java.util.concurrent.TimeUnit`

returns: the head of this deque, or null if the specified
         waiting time elapses before an element is available - `E`

throws: java.lang.InterruptedException - if interrupted while waiting
raw docstring

poll-lastclj

(poll-last this)
(poll-last this timeout unit)

Description copied from interface: BlockingDeque

timeout - how long to wait before giving up, in units of unit - long unit - a TimeUnit determining how to interpret the timeout parameter - java.util.concurrent.TimeUnit

returns: the tail of this deque, or null if the specified waiting time elapses before an element is available - E

throws: java.lang.InterruptedException - if interrupted while waiting

Description copied from interface: BlockingDeque

timeout - how long to wait before giving up, in units of unit - `long`
unit - a TimeUnit determining how to interpret the timeout parameter - `java.util.concurrent.TimeUnit`

returns: the tail of this deque, or null if the specified
         waiting time elapses before an element is available - `E`

throws: java.lang.InterruptedException - if interrupted while waiting
raw docstring

popclj

(pop this)

Description copied from interface: Deque

returns: the element at the front of this deque (which is the top of the stack represented by this deque) - E

throws: java.util.NoSuchElementException - if this deque is empty

Description copied from interface: Deque

returns: the element at the front of this deque (which is the top
         of the stack represented by this deque) - `E`

throws: java.util.NoSuchElementException - if this deque is empty
raw docstring

pushclj

(push this e)

Description copied from interface: BlockingDeque

e - the element to push - E

throws: java.lang.IllegalStateException - if this deque is full

Description copied from interface: BlockingDeque

e - the element to push - `E`

throws: java.lang.IllegalStateException - if this deque is full
raw docstring

putclj

(put this e)

Description copied from interface: BlockingDeque

e - the element to add - E

throws: java.lang.NullPointerException - if the specified element is null

Description copied from interface: BlockingDeque

e - the element to add - `E`

throws: java.lang.NullPointerException - if the specified element is null
raw docstring

put-firstclj

(put-first this e)

Description copied from interface: BlockingDeque

e - the element to add - E

throws: java.lang.NullPointerException - if the specified element is null

Description copied from interface: BlockingDeque

e - the element to add - `E`

throws: java.lang.NullPointerException - if the specified element is null
raw docstring

put-lastclj

(put-last this e)

Description copied from interface: BlockingDeque

e - the element to add - E

throws: java.lang.NullPointerException - if the specified element is null

Description copied from interface: BlockingDeque

e - the element to add - `E`

throws: java.lang.NullPointerException - if the specified element is null
raw docstring

remaining-capacityclj

(remaining-capacity this)

Returns the number of additional elements that this deque can ideally (in the absence of memory or resource constraints) accept without blocking. This is always equal to the initial capacity of this deque less the current size of this deque.

Note that you cannot always tell if an attempt to insert an element will succeed by inspecting remainingCapacity because it may be the case that another thread is about to insert or remove an element.

returns: the remaining capacity - int

Returns the number of additional elements that this deque can ideally
 (in the absence of memory or resource constraints) accept without
 blocking. This is always equal to the initial capacity of this deque
 less the current size of this deque.

 Note that you cannot always tell if an attempt to insert
 an element will succeed by inspecting remainingCapacity
 because it may be the case that another thread is about to
 insert or remove an element.

returns: the remaining capacity - `int`
raw docstring

removeclj

(remove this)
(remove this o)

Removes the first occurrence of the specified element from this deque. If the deque does not contain the element, it is unchanged. More formally, removes the first element e such that o.equals(e) (if such an element exists). Returns true if this deque contained the specified element (or equivalently, if this deque changed as a result of the call).

This method is equivalent to removeFirstOccurrence.

o - element to be removed from this deque, if present - java.lang.Object

returns: true if this deque changed as a result of the call - boolean

Removes the first occurrence of the specified element from this deque.
 If the deque does not contain the element, it is unchanged.
 More formally, removes the first element e such that
 o.equals(e) (if such an element exists).
 Returns true if this deque contained the specified element
 (or equivalently, if this deque changed as a result of the call).

 This method is equivalent to
 removeFirstOccurrence.

o - element to be removed from this deque, if present - `java.lang.Object`

returns: true if this deque changed as a result of the call - `boolean`
raw docstring

remove-firstclj

(remove-first this)

Description copied from interface: Deque

returns: the head of this deque - E

throws: java.util.NoSuchElementException - if this deque is empty

Description copied from interface: Deque

returns: the head of this deque - `E`

throws: java.util.NoSuchElementException - if this deque is empty
raw docstring

remove-first-occurrenceclj

(remove-first-occurrence this o)

Description copied from interface: BlockingDeque

o - element to be removed from this deque, if present - java.lang.Object

returns: true if an element was removed as a result of this call - boolean

Description copied from interface: BlockingDeque

o - element to be removed from this deque, if present - `java.lang.Object`

returns: true if an element was removed as a result of this call - `boolean`
raw docstring

remove-lastclj

(remove-last this)

Description copied from interface: Deque

returns: the tail of this deque - E

throws: java.util.NoSuchElementException - if this deque is empty

Description copied from interface: Deque

returns: the tail of this deque - `E`

throws: java.util.NoSuchElementException - if this deque is empty
raw docstring

remove-last-occurrenceclj

(remove-last-occurrence this o)

Description copied from interface: BlockingDeque

o - element to be removed from this deque, if present - java.lang.Object

returns: true if an element was removed as a result of this call - boolean

Description copied from interface: BlockingDeque

o - element to be removed from this deque, if present - `java.lang.Object`

returns: true if an element was removed as a result of this call - `boolean`
raw docstring

sizeclj

(size this)

Returns the number of elements in this deque.

returns: the number of elements in this deque - int

Returns the number of elements in this deque.

returns: the number of elements in this deque - `int`
raw docstring

spliteratorclj

(spliterator this)

Returns a Spliterator over the elements in this deque.

The returned spliterator is weakly consistent.

The Spliterator reports Spliterator.CONCURRENT, Spliterator.ORDERED, and Spliterator.NONNULL.

returns: a Spliterator over the elements in this deque - java.util.Spliterator<E>

Returns a Spliterator over the elements in this deque.

 The returned spliterator is
 weakly consistent.

 The Spliterator reports Spliterator.CONCURRENT,
 Spliterator.ORDERED, and Spliterator.NONNULL.

returns: a Spliterator over the elements in this deque - `java.util.Spliterator<E>`
raw docstring

takeclj

(take this)

Description copied from interface: BlockingDeque

returns: the head of this deque - E

throws: java.lang.InterruptedException - if interrupted while waiting

Description copied from interface: BlockingDeque

returns: the head of this deque - `E`

throws: java.lang.InterruptedException - if interrupted while waiting
raw docstring

take-firstclj

(take-first this)

Description copied from interface: BlockingDeque

returns: the head of this deque - E

throws: java.lang.InterruptedException - if interrupted while waiting

Description copied from interface: BlockingDeque

returns: the head of this deque - `E`

throws: java.lang.InterruptedException - if interrupted while waiting
raw docstring

take-lastclj

(take-last this)

Description copied from interface: BlockingDeque

returns: the tail of this deque - E

throws: java.lang.InterruptedException - if interrupted while waiting

Description copied from interface: BlockingDeque

returns: the tail of this deque - `E`

throws: java.lang.InterruptedException - if interrupted while waiting
raw docstring

to-arrayclj

(to-array this)
(to-array this a)

Returns an array containing all of the elements in this deque, in proper sequence; the runtime type of the returned array is that of the specified array. If the deque fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this deque.

If this deque fits in the specified array with room to spare (i.e., the array has more elements than this deque), the element in the array immediately following the end of the deque is set to null.

Like the toArray() method, this method acts as bridge between array-based and collection-based APIs. Further, this method allows precise control over the runtime type of the output array, and may, under certain circumstances, be used to save allocation costs.

Suppose x is a deque known to contain only strings. The following code can be used to dump the deque into a newly allocated array of String:

String[] y = x.toArray(new String[0]);

Note that toArray(new Object[0]) is identical in function to toArray().

a - the array into which the elements of the deque are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose - T[]

returns: an array containing all of the elements in this deque - <T> T[]

throws: java.lang.ArrayStoreException - if the runtime type of the specified array is not a supertype of the runtime type of every element in this deque

Returns an array containing all of the elements in this deque, in
 proper sequence; the runtime type of the returned array is that of
 the specified array.  If the deque fits in the specified array, it
 is returned therein.  Otherwise, a new array is allocated with the
 runtime type of the specified array and the size of this deque.

 If this deque fits in the specified array with room to spare
 (i.e., the array has more elements than this deque), the element in
 the array immediately following the end of the deque is set to
 null.

 Like the toArray() method, this method acts as bridge between
 array-based and collection-based APIs.  Further, this method allows
 precise control over the runtime type of the output array, and may,
 under certain circumstances, be used to save allocation costs.

 Suppose x is a deque known to contain only strings.
 The following code can be used to dump the deque into a newly
 allocated array of String:



  String[] y = x.toArray(new String[0]);

 Note that toArray(new Object[0]) is identical in function to
 toArray().

a - the array into which the elements of the deque are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose - `T[]`

returns: an array containing all of the elements in this deque - `<T> T[]`

throws: java.lang.ArrayStoreException - if the runtime type of the specified array is not a supertype of the runtime type of every element in this deque
raw docstring

to-stringclj

(to-string this)

Description copied from class: AbstractCollection

returns: a string representation of this collection - java.lang.String

Description copied from class: AbstractCollection

returns: a string representation of this collection - `java.lang.String`
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close