Skip to content

Commit a31d9dd

Browse files
committed
Merge branch 'GP-28_add_README_into_main' into GP-28_Migrate_File_Reader_into_exercise/completed
2 parents 4f7bae8 + d7ff835 commit a31d9dd

File tree

3 files changed

+50
-13
lines changed
  • 2-0-data-structures-and-algorithms
  • 3-0-java-core/src/main/java/com/bobocode/file_reader

3 files changed

+50
-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
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# <img src="https://raw.githubusercontent.com/bobocode-projects/resources/master/image/logo_transparent_background.png" height=50/>File Reader exercise :muscle:
2+
Improve your Java SE and Clean Code skills
3+
### Task
4+
`FileReaders` is an API that allows you to read whole file content into a `String`. Your job is to
5+
implement the *todo* section of that class.
6+
7+
### Refactoring Task
8+
There is an dirty implementation of class `FileReaders` that **contains bad practices and code smells**. If you want to
9+
practice in **refactoring** and improve your **clean code skills** you can start from branch **exercise/dirty** instead of
10+
**master** and try to refactor existing implementation.
11+
12+
To verify your implementation, run `FileReadersTest.java`
13+
14+
### Pre-conditions :heavy_exclamation_mark:
15+
You're supposed to know how to work with text files and be able to write Java code
16+
17+
### How to start :question:
18+
* Just clone the repository and create a branch **exercise/your_username** if you want your code to be reviewed
19+
* Start implementing the **todo** section and verify your changes by running tests
20+
* If you don't have enough knowledge about this domain, check out the [links below](#related-materials-information_source)
21+
* Don't worry if you got stuck, checkout the **exercise/completed** branch and see the final implementation
22+
23+
### Related materials :information_source:
24+
* [Stream API tutorial](https://github.com/bobocode-projects/java-functional-features-tutorial/tree/master/stream-api)
25+

0 commit comments

Comments
 (0)