Skip to content

Commit 776300b

Browse files
authored
add stubs to doubly linked list (exercism#2183)
1 parent f4720f7 commit 776300b

1 file changed

Lines changed: 26 additions & 7 deletions

File tree

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
1-
/*
1+
class DoublyLinkedList<T> {
2+
private Element<T> head;
23

3-
Since this exercise has a difficulty of > 4 it doesn't come
4-
with any starter implementation.
5-
This is so that you get to practice creating classes and methods
6-
which is an important part of programming in Java.
4+
void push(T value) {
5+
throw new UnsupportedOperationException("Please implement the DoublyLinkedList.push() method.");
6+
}
77

8-
Please remove this comment when submitting your solution.
8+
T pop() {
9+
throw new UnsupportedOperationException("Please implement the DoublyLinkedList.pop() method.");
10+
}
911

10-
*/
12+
void unshift(T value) {
13+
throw new UnsupportedOperationException("Please implement the DoublyLinkedList.unshift() method.");
14+
}
15+
16+
T shift() {
17+
throw new UnsupportedOperationException("Please implement the DoublyLinkedList.shift() method.");
18+
}
19+
20+
private static final class Element<T> {
21+
private final T value;
22+
private Element<T> prev;
23+
private Element<T> next;
24+
25+
Element(T value, Element<T> prev, Element<T> next) {
26+
throw new UnsupportedOperationException("Please implement the Element constructor.");
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)