public class DoubleStack extends DoubleArrayList
| Constructor and Description |
|---|
DoubleStack()
Constructs a new empty DoubleStack.
|
DoubleStack(int initialCapacity)
Constructs an empty stack with the specified initial capacity and
with its capacity increment equal to zero.
|
DoubleStack(int initialCapacity,
int capacityIncrement)
Constructs an empty stack with the specified initial capacity and
capacity increment.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
empty()
Tests if this stack is empty.
|
double |
peek()
Looks at the object at the top of this stack without removing it
from the stack.
|
double |
peek(int n)
Peeks at n positions from the top of the stack.
|
double |
pop()
Removes the double at the top of this stack and returns it.
|
double |
push(double item)
Pushes an item onto the top of this stack.
|
double |
replace(int n,
double e)
Replaces the element at n positions from the top of the stack
with a new one; returns the old element.
|
int |
search(double d)
Returns the 1-based position wherethe specified double is on this
stack.
|
java.lang.String |
toString()
Returns a string representation of this Stack.
|
add, add, addAll, addAll, addAll, addAll, addElement, capacity, clear, clear, clone, contains, containsAll, containsAll, copyInto, elementAt, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAll, removeAllElements, removeAllFirst, removeAllFirst, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setIncrementFactor, setLast, setSize, size, toArray, trimToSizepublic DoubleStack()
public DoubleStack(int initialCapacity,
int capacityIncrement)
initialCapacity - the initial capacity of the stack.capacityIncrement - amount by which the capacity is increased on overflow.java.lang.IllegalArgumentException - if the specified initial capacity is negative.public DoubleStack(int initialCapacity)
initialCapacity - the initial capacity of the stack.java.lang.IllegalArgumentException - if the specified initial capacity is negative.public final double push(double item)
item - the item to be pushed onto this stack.public final double pop()
java.lang.ArrayIndexOutOfBoundsException - if this stack is empty.public final double peek()
java.lang.ArrayIndexOutOfBoundsException - if this stack is empty.public final double peek(int n)
n - the offset from the top (0 -> top, 1 -> top-1,...)java.lang.ArrayIndexOutOfBoundsException - if index out of range.public final double replace(int n,
double e)
n - the offset from the top (0 -> top, 1 -> top-1,...)e - the new elementjava.lang.ArrayIndexOutOfBoundsException - if index out of range.public final boolean empty()
public final int search(double d)
d - the desired double.public java.lang.String toString()
toString in class DoubleArrayList