30 lines
854 B
Java
30 lines
854 B
Java
import java.io.File;
|
|
import java.io.FileNotFoundException;
|
|
import java.lang.reflect.Array;
|
|
import java.util.Scanner;
|
|
import java.util.ArrayList;
|
|
|
|
public class TextReader {
|
|
public ArrayList<String> readFile(String filePath) {
|
|
ArrayList<String> lines = new ArrayList<>();
|
|
File file = new File (filePath);
|
|
|
|
try (Scanner scanner = new Scanner(file)) {
|
|
while (scanner.hasNextLine()) {
|
|
String line = scanner.nextLine();
|
|
lines.add(line);
|
|
}
|
|
} catch (FileNotFoundException e) {
|
|
System.out.println("es gibt keine datei im angegebenen dateipfad: "+filePath);
|
|
}
|
|
return lines;
|
|
}
|
|
|
|
public ArrayList<String> linesToWords(ArrayList<String> lines) {
|
|
ArrayList<String> words = new ArrayList<>();
|
|
|
|
return words;
|
|
}
|
|
|
|
}
|