Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6a0554e

Browse files
Merge pull request #7 from bobocode-projects/GP-26_Change_todo_exception_in_main
GP-26 replace todo exception
2 parents d046540 + ba54733 commit 6a0554e

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed

‎2-0-data-structures-and-algorithms/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
6+
<dependencies>
7+
<dependency>
8+
<groupId>com.bobocode</groupId>
9+
<artifactId>java-fundamentals-util</artifactId>
10+
<version>1.0-SNAPSHOT</version>
11+
<scope>compile</scope>
12+
</dependency>
13+
</dependencies>
614

715
<parent>
816
<groupId>com.bobocode</groupId>

‎2-0-data-structures-and-algorithms/src/main/java/com/bobocode/linked_list/LinkedList.java

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package com.bobocode.linked_list;
22

3+
4+
5+
import com.bobocode.util.ExerciseNotCompletedException;
6+
37
import 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

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /