Change worldTimes.computeIfAbsent() to worldTimes.getOrDefault()

This commit is contained in:
Fuzzlemann 2017-08-01 01:37:02 +02:00
parent 2b8860fcc4
commit f676c9086d
4 changed files with 6 additions and 4 deletions

View File

@ -200,6 +200,7 @@ public enum Phrase {
localeRows.add(line);
}
}
for (String localeRow : localeRows) {
try {
String[] split = localeRow.split(" <> ");

View File

@ -84,7 +84,7 @@ public class ActivityPart extends RawData {
private void playerActivityGraphs() {
List<TPS> tpsData = tpsPart.getTpsData();
addValue("playersonlineseries", PlayerActivityGraphCreator.buildSeriesDataString(tpsData));
addValue("%playersgraphcolor%", Settings.HCOLOR_ACT_ONL + "");
addValue("%playersgraphcolor%", Settings.HCOLOR_ACT_ONL.toString());
}
private void activityPiechart() {

View File

@ -35,7 +35,7 @@ public class WorldPart extends RawData {
}
public void addToWorld(String worldName, long playTime) {
Long value = worldTimes.computeIfAbsent(worldName, ifNotFound -> 0L);
Long value = worldTimes.getOrDefault(worldName, 0L);
worldTimes.put(worldName, value + playTime);
}
}

View File

@ -42,10 +42,11 @@ public class ComparatorTest {
for (int i = 0; i < 20; i++) {
test.add(new Point(r.nextLong(), r.nextLong()));
}
List<Long> longValues = test.stream().map(Point::getX).map(i -> (Long) (long) (double) i).collect(Collectors.toList());
List<Long> longValues = test.stream().map(Point::getX).map(i -> (long) (double) i).collect(Collectors.toList());
longValues.sort(Long::compare);
test.sort(new PointComparator());
List<Long> afterSort = test.stream().map(Point::getX).map(i -> (Long) (long) (double) i).collect(Collectors.toList());
List<Long> afterSort = test.stream().map(Point::getX).map(i -> (long) (double) i).collect(Collectors.toList());
assertEquals(longValues, afterSort);
}