forked from rampatra/Algorithms-and-Data-Structures-in-Java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStack.java
52 lines (46 loc) · 977 Bytes
/
Stack.java
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
45
46
47
48
49
50
51
52
package com.rampatra.base;
/**
* A generic interface for a stack.
*
* @author rampatra
* @since 4/3/15
*/
public interface Stack<E> {
/**
* Pushes an item onto the top of this stack.
*
* @param item
*/
public E push(E item);
/**
* Removes the object at the top of this stack and returns it.
* This method throws an exception if this queue is empty.
*
* @return
*/
public E pop();
/**
* Looks at the object at the top of this stack without
* removing it from the stack. This method throws an
* exception if this queue is empty.
*
* @return
*/
public E peek();
/**
* Returns the number of items currently in the stack.
*
* @return
*/
public int size();
/**
* Tests if this stack is empty.
*
* @return
*/
public boolean isEmpty();
/**
* Prints the content of the stack.
*/
public void print();
}