E
- the type of elements maintained by this stackpublic interface PStack<E>
Modifier and Type | Method and Description |
---|---|
boolean |
anyMatch(Predicate<E> predicate)
Test given predicate on elements and return true if any of elements matches the predicate
|
void |
forEach(Consumer<E> action)
Performs the given action for each element in this stack until all elements have been processed or the action throws an exception.
|
boolean |
isEmpty() |
E |
peek() |
E |
peek(int i) |
PStack<E> |
pop() |
PStack<E> |
push(E e) |
int |
size()
Naive implementation has O(n) time complexity, where n is number of elements.
|
String |
toString() |
E peek()
IllegalStateException
- if this stack is empty.E peek(int i)
i
- - index of element to be returned, 0 means top of the stackIllegalStateException
- if stack has less than i elementsPStack<E> pop()
IllegalStateException
- if this stack is empty.boolean isEmpty()
void forEach(Consumer<E> action)
boolean anyMatch(Predicate<E> predicate)
predicate
- predicate to be testedint size()
Copyright © 2012–2017 SonarSource. All rights reserved.