Compare commits
2 Commits
2562126caa
...
78dfa848fa
Author | SHA1 | Date | |
---|---|---|---|
78dfa848fa | |||
|
a1827ac6a4 |
25
src/GebietsDatei.java
Normal file
25
src/GebietsDatei.java
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class GebietsDatei {
|
||||||
|
|
||||||
|
private String dateiName;
|
||||||
|
|
||||||
|
public GebietsDatei(String dateiName) {
|
||||||
|
this.dateiName = dateiName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Gebiet> getGebiete() {
|
||||||
|
ArrayList<Gebiet> gebiete = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
Files.readAllLines(Paths.get(dateiName)).forEach(line -> {
|
||||||
|
String[] parts = line.split(";");
|
||||||
|
gebiete.add(new Gebiet(Integer.parseInt(parts[0]), Integer.parseInt(parts[1]), parts[2], Long.parseLong(parts[3]), Integer.parseInt(parts[4])));
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return gebiete;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user