Skip to content

Completed Sync #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions 2-0-data-structures-and-algorithms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<dependencies>
<dependency>
<groupId>com.bobocode</groupId>
<artifactId>java-fundamentals-util</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>

<parent>
<groupId>com.bobocode</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.bobocode.linked_list;



import com.bobocode.util.ExerciseNotCompletedException;

import java.util.NoSuchElementException;

/**
Expand All @@ -18,7 +22,7 @@ public class LinkedList<T> implements List<T> {
* @return a new list of elements the were passed as method parameters
*/
public static <T> List<T> of(T... elements) {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
throw new ExerciseNotCompletedException(); // todo: implement this method
}

/**
Expand All @@ -28,7 +32,7 @@ public static <T> List<T> of(T... elements) {
*/
@Override
public void add(T element) {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
throw new ExerciseNotCompletedException(); // todo: implement this method
}

/**
Expand All @@ -40,7 +44,7 @@ public void add(T element) {
*/
@Override
public void add(int index, T element) {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
throw new ExerciseNotCompletedException(); // todo: implement this method
}

/**
Expand All @@ -52,7 +56,7 @@ public void add(int index, T element) {
*/
@Override
public void set(int index, T element) {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
throw new ExerciseNotCompletedException(); // todo: implement this method
}

/**
Expand All @@ -64,18 +68,18 @@ public void set(int index, T element) {
*/
@Override
public T get(int index) {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
throw new ExerciseNotCompletedException(); // todo: implement this method
}

/**
* Returns the first element of the list. Operation is performed in constant time O(1)
*
* @return the first element of the list
* @throws java.util.NoSuchElementException if list is empty
* @throws NoSuchElementException if list is empty
*/
@Override
public T getFirst() {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
throw new ExerciseNotCompletedException(); // todo: implement this method
}

/**
Expand All @@ -86,7 +90,7 @@ public T getFirst() {
*/
@Override
public T getLast() {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
throw new ExerciseNotCompletedException(); // todo: implement this method
}

/**
Expand All @@ -97,7 +101,7 @@ public T getLast() {
*/
@Override
public void remove(int index) {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
throw new ExerciseNotCompletedException(); // todo: implement this method
}


Expand All @@ -108,7 +112,7 @@ public void remove(int index) {
*/
@Override
public boolean contains(T element) {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
throw new ExerciseNotCompletedException(); // todo: implement this method
}

/**
Expand All @@ -118,7 +122,7 @@ public boolean contains(T element) {
*/
@Override
public boolean isEmpty() {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
throw new ExerciseNotCompletedException(); // todo: implement this method
}

/**
Expand All @@ -128,14 +132,14 @@ public boolean isEmpty() {
*/
@Override
public int size() {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
throw new ExerciseNotCompletedException(); // todo: implement this method
}

/**
* Removes all list elements
*/
@Override
public void clear() {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
throw new ExerciseNotCompletedException(); // todo: implement this method
}
}
8 changes: 8 additions & 0 deletions 3-0-java-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<dependencies>
<dependency>
<groupId>com.bobocode</groupId>
<artifactId>java-fundamentals-util</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>

<parent>
<groupId>com.bobocode</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.bobocode.file_reader;

import com.bobocode.util.ExerciseNotCompletedException;

/**
* {@link FileReaders} provides an API that allow to read whole file into a {@link String} by file name.
*/
public class FileReaders {

/**
* Returns a {@link String} that contains whole text from the file specified by name.
*
* @param fileName a name of a text file
* @return string that holds whole file content
*/
public static String readWholeFile(String fileName) {
throw new ExerciseNotCompletedException(); //todo
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.bobocode.file_reader;

import com.bobocode.file_reader.FileReaders;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;


public class FileReadersTest {

@Test
void testReadWholeFileOnEmptyFile() {
String fileContent = FileReaders.readWholeFile("empty.txt");

assertEquals("", fileContent);

}

@Test
void testReadWholeFileOnFileWithEmptyLines() {
String fileContent = FileReaders.readWholeFile("lines.txt");

assertEquals("Hey!\n" +
"\n" +
"What's up?\n" +
"\n" +
"Hi!", fileContent);
}

@Test
void testReadWholeFile() {
String fileContent = FileReaders.readWholeFile("simple.txt");

assertEquals("Hello!\n" + "It's a test file.", fileContent);
}
}
Empty file.
5 changes: 5 additions & 0 deletions 3-0-java-core/src/test/resources/lines.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Hey!

What's up?

Hi!
2 changes: 2 additions & 0 deletions 3-0-java-core/src/test/resources/simple.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Hello!
It's a test file.