Skip to content

Commit

Permalink
day: convert Mainland China to China
Browse files Browse the repository at this point in the history
  • Loading branch information
imkiva committed Mar 25, 2020
1 parent 31611d9 commit 4772ea7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/nonstop/covid19/api/Day.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public String getCountry() {
return country;
}

public void setCountry(String country) {
this.country = country;
}

public Date getDate() {
return date;
}
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/nonstop/covid19/geometry/Countries.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@
import java.util.stream.Collectors;

public class Countries {
private static Day mergeChina(Day day) {
if (day.getCountry().equals("Mainland China")) {
day.setCountry("China");
}
return day;
}

public static List<Country> from(List<Day> countries) {
return countries.stream()
.map(Countries::mergeChina)
.collect(Collectors.groupingBy(Day::getCountry))
.entrySet()
.stream()
Expand Down

0 comments on commit 4772ea7

Please sign in to comment.