Payload - The payload typepublic interface Stack<Payload> extends Source<Payload>
Stack is a linear first-in-last-out data structure.| Modifier and Type | Method and Description |
|---|---|
Source<Payload> |
clear()
Removes all payload values.
|
boolean |
equals(Object object)
Compares the given object with this
Stack for equality. |
Optional<Integer> |
firstIndexOf(Payload reference)
|
Optional<Integer> |
firstIndexOfMatch(Predicate<? super Payload> predicate)
|
Payload |
get(int index)
Returns the payload value at the given index, where 0 is the
index of most recently
pushed value. |
Payload |
getFirst()
Returns the first (i.e.
|
Optional<Payload> |
getFirst(Payload reference)
Returns the first (i.e.
|
Optional<Payload> |
getFirstMatch(Predicate<? super Payload> predicate)
Returns the first i.e.
|
int |
hashCode()
Returns the hash code of this
Stack. |
ProtectedIterator<Payload> |
iterator()
Returns a fail-fast
ProtectedIterator that starts with the first
(i.e. |
Payload |
pop()
Removes the first (i.e.
|
Source<Payload> |
popAll(int number)
Removes the given number of payload values. |
Source<Payload> |
popAllMatches(Predicate<? super Payload> predicate)
Removes the first (i.e.
|
Stack<Payload> |
push(Payload payload)
Pushes the given payload value as the new first value.
|
Stack<Payload> |
pushAll(Iterable<? extends Payload> payloads)
Pushes the given payload values in the given
order. |
Stack<Payload> |
pushAll(Payload... payloads)
Pushes the given payload values in the given
order. |
Payload |
replace(Payload payload)
Replaces the first (i.e.
|
contains, containsAll, containsAll, containsMatch, getAll, getAllMatches, isEmpty, sizeforEach, spliteratorStack<Payload> push(Payload payload) throws IllegalArgumentException
payload - The payload value to be pushed.Stack.IllegalArgumentException - If the given payload value is null and this
Sequence doesn't allow a null to be added.Stack<Payload> pushAll(Payload... payloads) throws IllegalArgumentException
payloads - The array of payload values to be pushed.Stack.IllegalArgumentException - If the given array of payload values is null or if
one of the given payload values is null and this
Sequence doesn't allow a null to be added.Stack<Payload> pushAll(Iterable<? extends Payload> payloads) throws IllegalArgumentException
payloads - The Iterable of payload values to be pushed.Stack.IllegalArgumentException - If the given Iterable of payload values is
null or if one of the given payload values is
null and this Sequence doesn't allow a
null to be added.Payload pop() throws NoSuchElementException
pushed)
payload value.NoSuchElementException - If this Stack is empty.Source<Payload> popAll(int number) throws IllegalArgumentException
Removes the given number of payload values.number - The number of payload values to be popped.Source yielding the removed payload values.IllegalArgumentException - If the given index is negative or if the given index is larger
than the size of this Stack .Source<Payload> popAllMatches(Predicate<? super Payload> predicate) throws IllegalArgumentException
pushed)
payload values as long as this Stack is not empty and
the first payload value satisfies the given predicate.predicate - The Predicate to be used.Source yielding the removed payload values.IllegalArgumentException - If the given Predicate is null.Payload get(int index) throws IndexOutOfBoundsException
pushed value.index - The index to be used.IndexOutOfBoundsException - If the given index is negative or if the given index is equal
to or larger than the size of this
Stack.Payload getFirst() throws NoSuchElementException
pushed)
payload value.getFirst in interface Source<Payload>NoSuchElementException - If this IndexedSource is empty.Optional<Payload> getFirstMatch(Predicate<? super Payload> predicate) throws IllegalArgumentException
getFirstMatch in interface Source<Payload>predicate - The Predicate to be used.Optional yielding the payload value.IllegalArgumentException - If the given Predicate is null.Payload replace(Payload payload) throws IllegalArgumentException, NoSuchElementException
pushed)
payload value with the given payload value.
payload - The payload value to be used.IllegalArgumentException - If the given payload value is null and this
Sequence doesn't allow a null to be added.NoSuchElementException - If this Stack is empty.Source<Payload> clear()
This may be a bulk operation and not a short hand for a multiple
pops.
Source yielding the removed payload values.Optional<Integer> firstIndexOf(Payload reference)
equality, of the given reference payload value, where 0 is the
index of most recently pushed value.reference - The reference payload value to be used.Optional yielding the index.Optional<Integer> firstIndexOfMatch(Predicate<? super Payload> predicate) throws IllegalArgumentException
Predicate, where 0 is the
index of most recently pushed value.predicate - The Predicate value to be used.Optional yielding the index.IllegalArgumentException - If the given Predicate is null.ProtectedIterator<Payload> iterator()
ProtectedIterator that starts with the first
(i.e. most recently pushed) payload value.iterator in interface Iterable<Payload>iterator in interface ProtectedIterable<Payload>ProtectedIterator.int hashCode()
Stack.
The hash code of a Stack is defined to be the result of the
following calculation:
int hashCode = 1;
Iterator<Payload> iterator = stack.iterator();
while (iterator.hasNext()) {
Payload payload = iterator.next();
hashCode = 31 * hashCode + (null == payload ? 0 : payload.hashCode());
}
boolean equals(Object object)
Copyright © 2016–2017 Markenwerk – Gesellschaft für markenbildende Maßnahmen mbH. All rights reserved.