mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-27 11:37:41 +01:00
Change worldTimes.computeIfAbsent() to worldTimes.getOrDefault()
This commit is contained in:
parent
2b8860fcc4
commit
f676c9086d
@ -200,6 +200,7 @@ public enum Phrase {
|
||||
localeRows.add(line);
|
||||
}
|
||||
}
|
||||
|
||||
for (String localeRow : localeRows) {
|
||||
try {
|
||||
String[] split = localeRow.split(" <> ");
|
||||
|
@ -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() {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user