commit c5f0530e1b2ffba49dc51155ca80d3d5104dfe15 Author: Karsten Loesing karsten.loesing@gmx.net Date: Mon Aug 20 15:20:36 2018 +0200
Use more powerful Map methods. --- src/main/java/org/torproject/metrics/web/News.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/main/java/org/torproject/metrics/web/News.java b/src/main/java/org/torproject/metrics/web/News.java index deeddf2..bd80ad4 100644 --- a/src/main/java/org/torproject/metrics/web/News.java +++ b/src/main/java/org/torproject/metrics/web/News.java @@ -87,11 +87,7 @@ public class News { } List<String> placeNames = new ArrayList<>(); for (String place : this.places) { - if (countries.containsKey(place)) { - placeNames.add(countries.get(place)); - } else { - placeNames.add("Unknown Country"); - } + placeNames.add(countries.getOrDefault(place, "Unknown Country")); } return placeNames; }
tor-commits@lists.torproject.org