Skip to content
Snippets Groups Projects
Verified Commit 7bd3d87a authored by Jan Kožusznik's avatar Jan Kožusznik
Browse files

Format. Change artifact id

parent 9abb1f5a
No related merge requests found
Pipeline #175 canceled with stages
......@@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>vsb-cs-java1</groupId>
<artifactId>lab07-efrei</artifactId>
<artifactId>efrei-lab-06-comparable-comparator</artifactId>
<version>0.0.1-SNAPHOST</version>
<packaging>jar</packaging>
<properties>
......
......@@ -14,44 +14,47 @@ import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/**
* @author Jan Kožusznik
* @version 0.1
*/
public class Book {
private final String data;
/**
*
*/
public Book() {
data = getText();
}
public Collection<String> getWords() {
String[] tokens = getText().split("[\\- \t\n.,;:()\\[\\]{}\"]+");
return new ArrayList<>(Arrays.asList(tokens));
}
@Override
public String toString() {
return data;
}
private String getText() {
StringBuilder sb = new StringBuilder();
try(BufferedReader br = new BufferedReader(new InputStreamReader(Book.class.getResourceAsStream("book.txt")))) {
String line;
while((line = br.readLine()) != null) {
sb.append(line).append('\n');
}
} catch (IOException e) {
e.printStackTrace();
return "";
private final String data;
/**
*
*/
public Book() {
data = getText();
}
public Collection<String> getWords() {
String[] tokens = getText().split("[\\- \t\n.,;:()\\[\\]{}\"]+");
return new ArrayList<>(Arrays.asList(tokens));
}
return sb.toString();
}
@Override
public String toString() {
return data;
}
private String getText() {
StringBuilder sb = new StringBuilder();
try (BufferedReader br = new BufferedReader(
new InputStreamReader(Book.class.getResourceAsStream("book.txt")))) {
String line;
while ((line = br.readLine()) != null) {
sb.append(line).append('\n');
}
} catch (IOException e) {
e.printStackTrace();
return "";
}
return sb.toString();
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment