1
1
package com .bobocode .linked_list ;
2
2
3
+
4
+
5
+ import com .bobocode .util .ExerciseNotCompletedException ;
6
+
3
7
import java .util .NoSuchElementException ;
4
8
5
9
/**
@@ -18,7 +22,7 @@ public class LinkedList<T> implements List<T> {
18
22
* @return a new list of elements the were passed as method parameters
19
23
*/
20
24
public static <T > List <T > of (T ... elements ) {
21
- throw new UnsupportedOperationException ( "This method is not implemented yet" ); // todo: implement this method
25
+ throw new ExerciseNotCompletedException ( ); // todo: implement this method
22
26
}
23
27
24
28
/**
@@ -28,7 +32,7 @@ public static <T> List<T> of(T... elements) {
28
32
*/
29
33
@ Override
30
34
public void add (T element ) {
31
- throw new UnsupportedOperationException ( "This method is not implemented yet" ); // todo: implement this method
35
+ throw new ExerciseNotCompletedException ( ); // todo: implement this method
32
36
}
33
37
34
38
/**
@@ -40,7 +44,7 @@ public void add(T element) {
40
44
*/
41
45
@ Override
42
46
public void add (int index , T element ) {
43
- throw new UnsupportedOperationException ( "This method is not implemented yet" ); // todo: implement this method
47
+ throw new ExerciseNotCompletedException ( ); // todo: implement this method
44
48
}
45
49
46
50
/**
@@ -52,7 +56,7 @@ public void add(int index, T element) {
52
56
*/
53
57
@ Override
54
58
public void set (int index , T element ) {
55
- throw new UnsupportedOperationException ( "This method is not implemented yet" ); // todo: implement this method
59
+ throw new ExerciseNotCompletedException ( ); // todo: implement this method
56
60
}
57
61
58
62
/**
@@ -64,18 +68,18 @@ public void set(int index, T element) {
64
68
*/
65
69
@ Override
66
70
public T get (int index ) {
67
- throw new UnsupportedOperationException ( "This method is not implemented yet" ); // todo: implement this method
71
+ throw new ExerciseNotCompletedException ( ); // todo: implement this method
68
72
}
69
73
70
74
/**
71
75
* Returns the first element of the list. Operation is performed in constant time O(1)
72
76
*
73
77
* @return the first element of the list
74
- * @throws java.util. NoSuchElementException if list is empty
78
+ * @throws NoSuchElementException if list is empty
75
79
*/
76
80
@ Override
77
81
public T getFirst () {
78
- throw new UnsupportedOperationException ( "This method is not implemented yet" ); // todo: implement this method
82
+ throw new ExerciseNotCompletedException ( ); // todo: implement this method
79
83
}
80
84
81
85
/**
@@ -86,7 +90,7 @@ public T getFirst() {
86
90
*/
87
91
@ Override
88
92
public T getLast () {
89
- throw new UnsupportedOperationException ( "This method is not implemented yet" ); // todo: implement this method
93
+ throw new ExerciseNotCompletedException ( ); // todo: implement this method
90
94
}
91
95
92
96
/**
@@ -97,7 +101,7 @@ public T getLast() {
97
101
*/
98
102
@ Override
99
103
public void remove (int index ) {
100
- throw new UnsupportedOperationException ( "This method is not implemented yet" ); // todo: implement this method
104
+ throw new ExerciseNotCompletedException ( ); // todo: implement this method
101
105
}
102
106
103
107
@@ -108,7 +112,7 @@ public void remove(int index) {
108
112
*/
109
113
@ Override
110
114
public boolean contains (T element ) {
111
- throw new UnsupportedOperationException ( "This method is not implemented yet" ); // todo: implement this method
115
+ throw new ExerciseNotCompletedException ( ); // todo: implement this method
112
116
}
113
117
114
118
/**
@@ -118,7 +122,7 @@ public boolean contains(T element) {
118
122
*/
119
123
@ Override
120
124
public boolean isEmpty () {
121
- throw new UnsupportedOperationException ( "This method is not implemented yet" ); // todo: implement this method
125
+ throw new ExerciseNotCompletedException ( ); // todo: implement this method
122
126
}
123
127
124
128
/**
@@ -128,14 +132,14 @@ public boolean isEmpty() {
128
132
*/
129
133
@ Override
130
134
public int size () {
131
- throw new UnsupportedOperationException ( "This method is not implemented yet" ); // todo: implement this method
135
+ throw new ExerciseNotCompletedException ( ); // todo: implement this method
132
136
}
133
137
134
138
/**
135
139
* Removes all list elements
136
140
*/
137
141
@ Override
138
142
public void clear () {
139
- throw new UnsupportedOperationException ( "This method is not implemented yet" ); // todo: implement this method
143
+ throw new ExerciseNotCompletedException ( ); // todo: implement this method
140
144
}
141
145
}
0 commit comments