Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
delabassee committed Jul 31, 2018
1 parent 5d317f6 commit 7973582
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

import java.util.*;

public class Countries {
public class Country {

static class Country {
private String iso;
private String code;
private String name;
Expand All @@ -30,10 +29,9 @@ public String getName() {
public String toString() {
return iso + " - " + code + " - " + name;
}
}


public static String getName(String countryCode) {
public static String getNameByCode(String countryCode) {

String[] isoCountries = Locale.getISOCountries();
String upperCode = countryCode.toUpperCase();
Expand All @@ -48,8 +46,7 @@ public static String getName(String countryCode) {
}



public static String getCode(String countryName) {
public static String getCodeByName(String countryName) {

String[] isoCountries = Locale.getISOCountries();
String upperName = countryName.toUpperCase();
Expand All @@ -64,7 +61,7 @@ public static String getCode(String countryName) {
}


public static List<Country> getAllCountries() {
public static List<Country> getAll() {

List<Country> countries = new ArrayList<Country>();
String[] isoCountries = Locale.getISOCountries();
Expand All @@ -79,7 +76,6 @@ public static List<Country> getAllCountries() {
countries.add(new Country(iso, code, name));
}
}

return countries;

}
Expand Down

0 comments on commit 7973582

Please sign in to comment.