Skip to content

Instantly share code, notes, and snippets.

@brunoborges
Last active August 29, 2015 13:57
Show Gist options
  • Save brunoborges/9864750 to your computer and use it in GitHub Desktop.
Save brunoborges/9864750 to your computer and use it in GitHub Desktop.
package foo;
import java.util.Arrays;
import java.util.Locale;
/**
* @author bruno borges
*/
public class Foo {
public static void main(String[] args) {
final String formatOutput = "Country : %s \t\t\t\t:\t Country Code : %s";
List<String> list =
Arrays.asList(Locale.getISOCountries())
.stream()
.map(c -> new Locale("", c))
.sorted((c0, c1) -> c0.getDisplayCountry().compareTo(c1.getDisplayCountry()))
.map(l -> String.format(formatOutput, l.getDisplayCountry(), l.getCountry()))
.collect(Collectors.toList());
list.forEach(System.out::println);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment