| com.davidluoye.support.util.queue.IQueue<T> |
Known Indirect Subclasses
FixQueue<T>,
SynchronizedFixQueue<T>
|
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| class | IQueue.Itr<T> | ||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| abstract boolean |
add(Collection<T> cc)
Inserts the specified elements into tail of this queue.
| ||||||||||
| abstract boolean |
add(T t)
Inserts the specified element into tail of this queue.
| ||||||||||
| abstract boolean | add(T[] cc) | ||||||||||
| abstract boolean |
contains(Object o)
Returns true if this queue contains the specified element.
| ||||||||||
| abstract int | findEach(BiFunction<Integer, ? super T, Boolean> action) | ||||||||||
| abstract T | findEach(Function<? super T, Boolean> action) | ||||||||||
| abstract void |
forEach(Consumer<? super T> action)
Performs the given action for each element of the
Iterable
until all elements have been processed or the action throws an
exception. | ||||||||||
| abstract void |
forEach(BiConsumer<Integer, ? super T> action)
Performs the given action for each element of the
Iterable
until all elements have been processed or the action throws an
exception. | ||||||||||
| abstract T |
get(int index)
Retrieves, but does not remove, the special index element of this queue.
| ||||||||||
| abstract List<T> | getQueue() | ||||||||||
| abstract int |
indexOf(T t)
Returns the index of the first occurrence of the specified element
in this list, or -1 if this list does not contain the element.
| ||||||||||
| abstract boolean |
isEmpty()
Returns true if this queue contains no elements.
| ||||||||||
| abstract boolean |
isNotEmpty()
Returns true if this queue contains elements.
| ||||||||||
| abstract Iterator<T> | iterator() | ||||||||||
| abstract T |
peek()
Retrieves, but does not remove, the head of this queue,
or returns
null if this queue is empty. | ||||||||||
| abstract T |
poll()
Retrieves and removes the head of this queue,
or returns
null if this queue is empty. | ||||||||||
| abstract T |
pop()
Retrieves and removes the tail of this queue,
or returns
null if this queue is empty. | ||||||||||
| abstract T |
remove(int index)
Remove the special index element from this queue.
| ||||||||||
| abstract void |
remove()
Remove all the elements from this queue.
| ||||||||||
| abstract int |
size()
Returns the number of elements in this queue.
| ||||||||||
| abstract Spliterator<T> |
spliterator(int startInclusive, int endExclusive)
Creates a
Spliterator covering a range of elements of a given
array, using a customized set of spliterator characteristics. | ||||||||||
| abstract Stream<T> |
stream(int startInclusive, int endExclusive)
Returns a sequential Stream with the specified range of the
specified array as its source.
| ||||||||||
| abstract Stream<T> |
stream()
Returns a sequential
Stream with this queue as its source. | ||||||||||
| abstract T |
tail()
Retrieves, but does not remove, the tail of this queue,
or returns
null if this queue is empty. | ||||||||||
| abstract Object[] |
toArray()
Returns an array containing all of the elements in this queue
in proper sequence (from first to last element).
| ||||||||||
| abstract <T> T[] |
toArray(T[] a)
Returns an array containing all of the elements in this queue
in proper sequence (from first to last element).
| ||||||||||
| abstract <A> A[] |
toArray(IntFunction<A[]> generator)
Returns an array containing the elements of this stream, using the
provided
generator function to allocate the returned array, as
well as any additional arrays that might be required for a partitioned
execution or for resizing. | ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From interface
java.lang.Iterable
| |||||||||||
Inserts the specified elements into tail of this queue.
| cc | the element to add |
|---|
true (as specified by add(E))
Inserts the specified element into tail of this queue.
| t | the element to add |
|---|
true (as specified by add(E))
Returns true if this queue contains the specified element. More formally, returns true if and only if this queue contains at least one element e such that (o==null ? e==null : o.equals(e)).
| o | element whose presence in this queue is to be tested |
|---|
| ClassCastException | if the type of the specified element is incompatible with this queue (optional) |
|---|
Performs the given action for each element of the Iterable
until all elements have been processed or the action throws an
exception. Unless otherwise specified by the implementing class,
actions are performed in the order of iteration (if an iteration order
is specified). Exceptions thrown by the action are relayed to the
caller.
The default implementation behaves as if:
for (T t : this)
action.accept(t);
| action | The action to be performed for each element |
|---|
| NullPointerException | if the specified action is null |
|---|
Performs the given action for each element of the Iterable
until all elements have been processed or the action throws an
exception. Unless otherwise specified by the implementing class,
actions are performed in the order of iteration (if an iteration order
is specified). Exceptions thrown by the action are relayed to the
caller.
| action | The action to be performed for each element |
|---|
| NullPointerException | if the specified action is null |
|---|
Retrieves, but does not remove, the special index element of this queue.
| IndexOutOfBoundsException | if index is not valid |
|---|
Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.
Returns true if this queue contains no elements.
Returns true if this queue contains elements.
Retrieves, but does not remove, the head of this queue,
or returns null if this queue is empty.
null if this queue is empty
Retrieves and removes the head of this queue,
or returns null if this queue is empty.
null if this queue is empty
Retrieves and removes the tail of this queue,
or returns null if this queue is empty.
null if this queue is empty
Remove the special index element from this queue.
| IndexOutOfBoundsException | if index is not valid |
|---|
Remove all the elements from this queue.
Returns the number of elements in this queue.
Creates a Spliterator covering a range of elements of a given
array, using a customized set of spliterator characteristics.
This method is provided as an implementation convenience for
Spliterators which store portions of their elements in arrays, and need
fine control over Spliterator characteristics. Most other situations in
which a Spliterator for an array is needed should use
spliterator(Object[]).
The returned spliterator always reports the characteristics
SIZED and SUBSIZED. The caller may provide additional
characteristics for the spliterator to report; it is common to
additionally specify IMMUTABLE and ORDERED.
| startInclusive | The least index (inclusive) to cover |
|---|---|
| endExclusive | One past the greatest index to cover |
| NullPointerException | if the given array is null |
|---|---|
| ArrayIndexOutOfBoundsException | if fromIndex is negative,
toIndex is less than fromIndex, or
toIndex is greater than the array size |
Returns a sequential Stream with the specified range of the specified array as its source.
| startInclusive | the first index to cover, inclusive |
|---|---|
| endExclusive | index immediately past the last index to cover |
Stream for the array range| ArrayIndexOutOfBoundsException | if startInclusive is
negative, endExclusive is less than
startInclusive, or endExclusive is greater than
the array size
|
|---|
Returns a sequential Stream with this queue as its source.
This method should be overridden when the spliterator()
method cannot return a spliterator that is IMMUTABLE,
CONCURRENT, or late-binding. (See spliterator()
for details.)
The default implementation creates a sequential Stream from the
queue's Spliterator.
Stream over the elements in this collection
Retrieves, but does not remove, the tail of this queue,
or returns null if this queue is empty.
null if this queue is empty
Returns an array containing all of the elements in this queue in proper sequence (from first to last element).
The returned array will be "safe" in that no references to it are maintained by this list. (In other words, this method must allocate a new array). The caller is thus free to modify the returned array.
This method acts as bridge between array-based and collection-based APIs.
Returns an array containing all of the elements in this queue in proper sequence (from first to last element).
The returned array will be "safe" in that no references to it are maintained by this list. (In other words, this method must allocate a new array). The caller is thus free to modify the returned array.
This method acts as bridge between array-based and collection-based APIs.
Returns an array containing the elements of this stream, using the
provided generator function to allocate the returned array, as
well as any additional arrays that might be required for a partitioned
execution or for resizing.
This is a terminal operation. The generator function takes an integer, which is the size of the desired array, and produces an array of the desired size. This can be concisely expressed with an array constructor reference:
Person[] men = people.stream()
.filter(p -> p.getGender() == MALE)
.toArray(Person[]::new);
| generator | a function which produces a new array of the desired type and the provided length |
|---|
| ArrayStoreException | if the runtime type of the array returned from the array generator is not a supertype of the runtime type of every element in this stream |
|---|