-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStack.java
More file actions
44 lines (38 loc) · 1.08 KB
/
Copy pathStack.java
File metadata and controls
44 lines (38 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package edu.cofc.cs.csci230;
import java.util.EmptyStackException;
/**
* Last in First Out (LIFO) Stack
*
* Stack interface that "closely" resembles the Stack class
* defined in the java.util package, see link below.
*
* http://docs.oracle.com/javase/7/docs/api/java/util/Stack.html
*
* @author CSCI 230: Data Structures and Algorithms Fall 2016
*
* @param <AnyType>
*/
public interface Stack<AnyType> {
/**
* Pushes an item onto the top of the stack.
*
* @param t the item to be pushed onto this stack.
*/
public void push( AnyType t );
/**
* Removes the object at the top of the stack and returns the
* item
* .
* @return The item at the top of this stack
* @throws EmptyStackException - if this stack is empty.
*/
public AnyType pop() throws EmptyStackException;
/**
* Looks at the item at the top of the stack without removing it
* from the stack.
*
* @return the item at the top of this stack
* @throws EmptyStackException - if this stack is empty.
*/
public AnyType peek() throws EmptyStackException;
} // end Stack interface description