Solved 3.2.3
This commit is contained in:
parent
fa9ca8a340
commit
043a34c0bd
1 changed files with 1 additions and 8 deletions
|
|
@ -156,22 +156,15 @@ public class Resources {
|
||||||
InputStream is = Resources.class.getClassLoader().getResourceAsStream("highscores.txt");
|
InputStream is = Resources.class.getClassLoader().getResourceAsStream("highscores.txt");
|
||||||
InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8);
|
InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8);
|
||||||
BufferedReader br = new BufferedReader(isr);
|
BufferedReader br = new BufferedReader(isr);
|
||||||
ScoreEntry temp;
|
|
||||||
scoreEntries = new LinkedList<>();
|
scoreEntries = new LinkedList<>();
|
||||||
String line;
|
String line;
|
||||||
try {
|
try {
|
||||||
while((line = br.readLine()) != null) {
|
while((line = br.readLine()) != null) {
|
||||||
line = line.trim();
|
line = line.trim();
|
||||||
if(line.length() > 0 && !line.startsWith("#")) {
|
if(line.length() > 0 && !line.startsWith("#")) {
|
||||||
temp = ScoreEntry.read(line);
|
addScoreEntry(ScoreEntry.read(line));
|
||||||
scoreEntries.add(temp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Collections.sort(scoreEntries, new Comparator<ScoreEntry>() {
|
|
||||||
@Override
|
|
||||||
public int compare(ScoreEntry s1, ScoreEntry s2) {
|
|
||||||
return s1.compareTo(s2);
|
|
||||||
} } );
|
|
||||||
|
|
||||||
br.close();
|
br.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue