commit c44822c1f10c0f92ec6ef8e77fcb88f29e96d548 Author: Karsten Loesing karsten.loesing@gmx.net Date: Wed Nov 20 16:38:53 2019 +0100
Remove unnecessary casts. --- src/main/java/org/torproject/metrics/stats/advbwdist/Main.java | 2 +- src/main/java/org/torproject/metrics/stats/hidserv/Parser.java | 2 +- src/main/java/org/torproject/metrics/stats/hidserv/Simulate.java | 2 +- src/test/java/org/torproject/metrics/web/DirectoryListingTest.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/torproject/metrics/stats/advbwdist/Main.java b/src/main/java/org/torproject/metrics/stats/advbwdist/Main.java index d6bf4db..da335ce 100644 --- a/src/main/java/org/torproject/metrics/stats/advbwdist/Main.java +++ b/src/main/java/org/torproject/metrics/stats/advbwdist/Main.java @@ -205,7 +205,7 @@ public class Main { computedPercentiles.put(p, minValue); } else { computedPercentiles.put(p, - (long) Math.floor(percentile.evaluate((double) p))); + (long) Math.floor(percentile.evaluate(p))); } } return computedPercentiles; diff --git a/src/main/java/org/torproject/metrics/stats/hidserv/Parser.java b/src/main/java/org/torproject/metrics/stats/hidserv/Parser.java index 558ce39..57a0d5f 100644 --- a/src/main/java/org/torproject/metrics/stats/hidserv/Parser.java +++ b/src/main/java/org/torproject/metrics/stats/hidserv/Parser.java @@ -147,7 +147,7 @@ public class Parser { * file, followed by its absolute path. */ String absolutePath = e.getKey(); long lastModifiedMillis = e.getValue(); - bw.write(String.valueOf(lastModifiedMillis) + " " + absolutePath + bw.write(lastModifiedMillis + " " + absolutePath + "\n"); } } catch (IOException e) { diff --git a/src/main/java/org/torproject/metrics/stats/hidserv/Simulate.java b/src/main/java/org/torproject/metrics/stats/hidserv/Simulate.java index 445d931..f5e1b85 100644 --- a/src/main/java/org/torproject/metrics/stats/hidserv/Simulate.java +++ b/src/main/java/org/torproject/metrics/stats/hidserv/Simulate.java @@ -271,7 +271,7 @@ public class Simulate { for (Map.Entry<Double, SortedSet<Integer>> e : storedDescs.entrySet()) { double fingerprint = e.getKey(); - long observed = (long) e.getValue().size(); + long observed = e.getValue().size(); long afterBinning = ((observed + binSize - 1L) / binSize) * binSize; double randomDouble = rnd.nextDouble(); double laplaceNoise = -b * (randomDouble > 0.5 ? 1.0 : -1.0) diff --git a/src/test/java/org/torproject/metrics/web/DirectoryListingTest.java b/src/test/java/org/torproject/metrics/web/DirectoryListingTest.java index 3bd354f..a74df81 100644 --- a/src/test/java/org/torproject/metrics/web/DirectoryListingTest.java +++ b/src/test/java/org/torproject/metrics/web/DirectoryListingTest.java @@ -54,7 +54,7 @@ public class DirectoryListingTest { assertEquals(4, dl.size()); for (String key : new String[]{"/collector/a1/", "/collector/", "/collector/a1/p2/", "/collector/a1/p1/"}) { - assertTrue("Missing: " + key, dl.keySet().contains(key)); + assertTrue("Missing: " + key, dl.containsKey(key)); } assertEquals("[Parent Directory, /collector.html, , ]", Arrays.toString(dl.get("/collector/").get(0)));
tor-commits@lists.torproject.org