public final class SimpleStack<T> extends Object implements List<T>
Constructor and Description |
---|
SimpleStack()
Construct a stack, default size is 20
|
SimpleStack(int size)
construct a stack with specified size
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
T element) |
boolean |
add(T e) |
boolean |
addAll(Collection<? extends T> c) |
boolean |
addAll(int index,
Collection<? extends T> c) |
void |
clear()
Clear the stack - also makes sure the stack objects are not referenced anymore
|
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
boolean |
equals(Object obj) |
T |
get(int index) |
T |
getFromPtr(int ptr)
get element from stack at index relative to base
|
int |
getPtr()
get the curent stack pos relative to base
|
int |
hashCode() |
int |
indexOf(Object o) |
boolean |
isEmpty()
check if stack is empty
|
Iterator<T> |
iterator() |
int |
lastIndexOf(Object o) |
ListIterator<T> |
listIterator() |
ListIterator<T> |
listIterator(int index) |
T |
peek()
take a look at the top of stack
|
T[] |
peek(int n) |
T |
peekElemAfter(T until) |
T |
peekFromTop(int n) |
T[] |
peekUntil(T until) |
T |
pop()
pops object out of stack
|
T[] |
pop(int n) |
void |
popTo(T[] to,
int n) |
T[] |
popUntil(T until) |
void |
push(T o)
push object into stack
|
void |
pushAll(T[] args)
Push more objects into the stack
|
void |
remove() |
T |
remove(int index) |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
void |
removeFromTop(int n) |
void |
replaceFromTop(int n,
T value) |
boolean |
retainAll(Collection<?> c) |
T |
set(int index,
T element) |
int |
size() |
List<T> |
subList(int fromIndex,
int toIndex) |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
String |
toString() |
String |
toString(char separator)
returns a character separated string with the stack elements
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
replaceAll, sort, spliterator
parallelStream, removeIf, stream
public SimpleStack(int size)
public SimpleStack()
public boolean isEmpty()
public void push(T o)
o
- Objectpublic void pushAll(T[] args)
args
- public T pop()
public void remove()
public T[] pop(int n)
public void popTo(T[] to, int n)
public void removeFromTop(int n)
public T peek()
public T peekFromTop(int n)
public void replaceFromTop(int n, T value)
public T[] peek(int n)
public void clear()
public int getPtr()
public T getFromPtr(int ptr)
ptr
- public String toString(char separator)
separator
- public int size()
public boolean contains(Object o)
public Object[] toArray()
public <T> T[] toArray(T[] a)
public boolean add(T e)
public boolean remove(Object o)
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<T>
containsAll
in interface List<T>
public boolean addAll(Collection<? extends T> c)
public boolean removeAll(Collection<?> c)
public boolean retainAll(Collection<?> c)
public boolean equals(Object obj)
public int hashCode()
public boolean addAll(int index, Collection<? extends T> c)
public int lastIndexOf(Object o)
lastIndexOf
in interface List<T>
public ListIterator<T> listIterator()
listIterator
in interface List<T>
public ListIterator<T> listIterator(int index)
listIterator
in interface List<T>
Copyright © 2018 SPF4J. All rights reserved.