MCPcopy Create free account
hub / github.com/Berkeley-CS61B/skeleton-sp23 / Deque

Interface Deque

proj1c/src/deque/Deque.java:9–79  ·  view source on GitHub ↗

Created by hug on 2/4/2017. Methods are provided in the suggested order that they should be completed.

Source from the content-addressed store, hash-verified

7 * that they should be completed.
8 */
9public interface Deque<T> {
10
11 /**
12 * Add {@code x} to the front of the deque. Assumes {@code x} is never null.
13 *
14 * @param x item to add
15 */
16 void addFirst(T x);
17
18 /**
19 * Add {@code x} to the back of the deque. Assumes {@code x} is never null.
20 *
21 * @param x item to add
22 */
23 void addLast(T x);
24
25 /**
26 * Returns a List copy of the deque. Does not alter tne deque.
27 *
28 * @return a new list copy of the deque.
29 */
30 List<T> toList();
31
32 /**
33 * Returns if the deque is empty. Does not alter the deque.
34 *
35 * @return {@code true} if the deque has no elements, {@code false} otherwise.
36 */
37 boolean isEmpty();
38
39 /**
40 * Returns the size of the deque. Does not alter the deque.
41 *
42 * @return the number of items in the deque.
43 */
44 int size();
45
46 /**
47 * Remove and return the element at the front of the deque, if it exists.
48 *
49 * @return removed element, otherwise {@code null}.
50 */
51 T removeFirst();
52
53 /**
54 * Remove and return the element at the back of the deque, if it exists.
55 *
56 * @return removed element, otherwise {@code null}.
57 */
58 T removeLast();
59
60 /**
61 * The Deque abstract data type does not typically have a get method,
62 * but we've included this extra operation to provide you with some
63 * extra programming practice. Gets the element, iteratively.Does
64 * not alter the deque.
65 *
66 * @param index index to get, assumes valid index

Callers 21

testCommonMethod · 0.65
handleResponsesMethod · 0.65
handleStageMethod · 0.65
parseResponseMethod · 0.65
toStringMethod · 0.65
readAllLinesMethod · 0.65
readAllLinesMethod · 0.65
readWordsMethod · 0.65
testCountHistoryMethod · 0.65
testFromSpecMethod · 0.65

Calls

no outgoing calls

Tested by

no test coverage detected