-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinterfazStack.java
More file actions
54 lines (44 loc) · 1.17 KB
/
interfazStack.java
File metadata and controls
54 lines (44 loc) · 1.17 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
45
46
47
48
49
50
51
52
53
54
import java.util.EmptyStackException;
/**
* Stack
*
* Interface que representa a un Stack.
*/
public interface interfazStack<E> {
/**
* pre:
* post: item is added to stack
* will be popped next if no intervening push
*
* @param item item to push to the stack.
*/
public void push(E item);
/**
* pre: stack is not empty
* post: most recently pushed item is removed and returned
*
* @return the element in the top of the stack.
* @throws EmptyStackException If the stack is empty.
*/
public E pop() throws EmptyStackException;
/**
* pre: stack is not empty
* post: top value (next to be popped) is returned
*
* @return the element in the top of the stack.
* @throws EmptyStackException If the stack is empty.
*/
public E peek() throws EmptyStackException;
/**
* post: returns true if and only if the stack is empty
*
* @return True if empty, false otherwise.
*/
public boolean empty();
/**
* post: returns the number of elements in the stack
*
* @return The number of elements in the stack.
*/
public int size();
}