11package com .bobocode .linked_list ;
22
3+
4+
5+ import com .bobocode .util .ExerciseNotCompletedException ;
6+
37import java .util .NoSuchElementException ;
48
59/**
@@ -18,7 +22,7 @@ public class LinkedList<T> implements List<T> {
1822 * @return a new list of elements the were passed as method parameters
1923 */
2024 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
2226 }
2327
2428 /**
@@ -28,7 +32,7 @@ public static <T> List<T> of(T... elements) {
2832 */
2933 @ Override
3034 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
3236 }
3337
3438 /**
@@ -40,7 +44,7 @@ public void add(T element) {
4044 */
4145 @ Override
4246 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
4448 }
4549
4650 /**
@@ -52,7 +56,7 @@ public void add(int index, T element) {
5256 */
5357 @ Override
5458 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
5660 }
5761
5862 /**
@@ -64,18 +68,18 @@ public void set(int index, T element) {
6468 */
6569 @ Override
6670 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
6872 }
6973
7074 /**
7175 * Returns the first element of the list. Operation is performed in constant time O(1)
7276 *
7377 * @return the first element of the list
74- * @throws java.util. NoSuchElementException if list is empty
78+ * @throws NoSuchElementException if list is empty
7579 */
7680 @ Override
7781 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
7983 }
8084
8185 /**
@@ -86,7 +90,7 @@ public T getFirst() {
8690 */
8791 @ Override
8892 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
9094 }
9195
9296 /**
@@ -97,7 +101,7 @@ public T getLast() {
97101 */
98102 @ Override
99103 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
101105 }
102106
103107
@@ -108,7 +112,7 @@ public void remove(int index) {
108112 */
109113 @ Override
110114 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
112116 }
113117
114118 /**
@@ -118,7 +122,7 @@ public boolean contains(T element) {
118122 */
119123 @ Override
120124 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
122126 }
123127
124128 /**
@@ -128,14 +132,14 @@ public boolean isEmpty() {
128132 */
129133 @ Override
130134 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
132136 }
133137
134138 /**
135139 * Removes all list elements
136140 */
137141 @ Override
138142 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
140144 }
141145}
0 commit comments