-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDeque.java
41 lines (30 loc) · 1.18 KB
/
Deque.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
/* TEAM BOATY
* Maxwell Vale, Dan Gelfand, Tim Marder
* APCS02 pd02
* lab#02 -- All Hands on Deque!
* 2018-04-20
*/
// Interface for a Deque --> A Double Ended Queue
public interface Deque<Card> {
// Inserts the specified element at the front of this deque
// unless it would violate capacity restrictions.
public boolean offerFirst(Card e);
// Inserts the specified element at the end of this deque
// unless it would violate capacity restrictions.
public boolean offerLast(Card e);
// Retrieves and removes the first element of this deque
// Returns the head of the deque or null if empty
public Card pollFirst();
// Retrieves and removes the last element of the deque
// Returns the tail of the deque or null if empty
public Card pollLast();
// Retrieves, but does not remove, the first element of the deque
// Returns the head of the deque or null if empty
public Card peekFirst();
// Retrieves, but does not remove, the last element of the deque
// Returns the tail of the deque or null if empty
public Card peekLast();
// Checks if the deque is empty
// Returns true if empty and false otherwise
public boolean isEmpty();
} // end interface Deque