From c5f0530e1b2ffba49dc51155ca80d3d5104dfe15 Mon Sep 17 00:00:00 2001 From: Karsten Loesing Date: Mon, 20 Aug 2018 15:20:36 +0200 Subject: [PATCH] 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 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; }