public class FixedStack<N> extends Object implements Stack<N>
Constructor and Description |
---|
FixedStack(int size)
construct a new stack of given capacity
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
clear the stack
|
boolean |
contains(N n)
Linear search the stack for contains - not an efficient operation
|
boolean |
isEmpty() |
N |
peek()
peek at the top of the stack
|
N |
pop()
pop the next element off the stack
|
boolean |
push(N n)
add an element to the stack
|
int |
remainingCapacity()
how much available space in the stack
|
int |
size()
Return the size of the stack
|
public FixedStack(int size)
size
- - the stack sizepublic boolean push(N n)
public boolean contains(N n)
Stack
public N peek()
public N pop()
public int size()
public int remainingCapacity()
remainingCapacity
in interface Stack<N>
public boolean isEmpty()
Copyright © 2012–2016 Conversant Engineering. All rights reserved.