diff --git a/src/main/java/app/entities/Stats.java b/src/main/java/app/entities/Stats.java index f4b0ba4..a85bd8d 100644 --- a/src/main/java/app/entities/Stats.java +++ b/src/main/java/app/entities/Stats.java @@ -8,6 +8,8 @@ import org.springframework.stereotype.Component; import java.time.Instant; import java.time.LocalDate; import java.util.HashMap; +import java.util.Map; +import java.util.stream.Collectors; @Data @Component @@ -87,4 +89,13 @@ public class Stats { } } + public HashMap getCountries() { + return new HashMap<>() {{ + countries.forEach((name, count) -> { + if (name != null && count != null && count > 0) { + put(name, count); + } + }); + }}; + } }