File tree Expand file tree Collapse file tree
exercises/practice/linked-list/src/main/java Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments