package io.github.arpankapoor.country;

import com.google.i18n.phonenumbers.PhoneNumberUtil;

import java.util.Locale;

public class Country {
    private String name;
    private String isoCode;
    private int callingCode;

    public Country(String isoCode) {
        this.isoCode = isoCode.toUpperCase();
        this.name = new Locale("", this.isoCode).getDisplayCountry();
        this.callingCode = PhoneNumberUtil.getInstance().getCountryCodeForRegion(this.isoCode);
    }

    @Override
    public String toString() {
        return name + " (+" + callingCode + ")";
    }

    public int getCallingCode() {
        return callingCode;
    }

    public void setCallingCode(int callingCode) {
        this.callingCode = callingCode;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIsoCode() {
        return isoCode;
    }

    public void setIsoCode(String isoCode) {
        this.isoCode = isoCode;
    }
}

@@ -33,16 +33,60 @@
 untry;%0A%0A
+import android.support.annotation.NonNull;%0A%0A
 import c
@@ -127,24 +127,53 @@
 umberUtil;%0A%0A
+import java.io.Serializable;%0A
 import java.
@@ -207,17 +207,133 @@
 Country 
-%7B
+implements Comparable%3CCountry%3E, Serializable %7B%0A    private static final long serialVersionUID = 8116297477768564397L;
 %0A    pri
@@ -449,39 +449,35 @@
 ) %7B%0A        
-this.i
+setI
 soCode
- = 
+(
 isoCode.toUp
@@ -485,16 +485,17 @@
 erCase()
+)
 ;%0A      
@@ -496,28 +496,24 @@
         
-this.name = 
+setName(
 new Loca
@@ -519,28 +519,28 @@
 ale(%22%22, 
-this.i
+getI
 soCode
+()
 ).getDis
@@ -552,16 +552,17 @@
 ountry()
+)
 ;%0A      
@@ -555,38 +555,36 @@
 try());%0A        
-this.c
+setC
 allingCode = Pho
@@ -577,19 +577,17 @@
 lingCode
- = 
+(
 PhoneNum
@@ -632,28 +632,29 @@
 rRegion(
-this.i
+getI
 soCode
+())
 );%0A    %7D
@@ -1198,11 +1198,135 @@
 e;%0A    %7D
+%0A%0A    @Override%0A    public int compareTo(@NonNull Country another) %7B%0A        return this.name.compareTo(another.name);%0A    %7D
 %0A%7D%0A

Implement Serializable and Comparable interfaces