Skip to content

Instantly share code, notes, and snippets.

@nandub
Created May 30, 2009 04:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nandub/120369 to your computer and use it in GitHub Desktop.
Save nandub/120369 to your computer and use it in GitHub Desktop.
import java.util.Map;
import org.apache.commons.lang.ArrayUtils;
public class Main {
public static void main(String[] args) {
String[][] countries = { { "United States", "New York" }, { "United Kingdom", "London" },
{ "Netherland", "Amsterdam" }, { "Japan", "Tokyo" }, { "France", "Paris" } };
Map countryCapitals = ArrayUtils.toMap(countries);
System.out.println("Capital of Japan is " + countryCapitals.get("Japan"));
System.out.println("Capital of France is " + countryCapitals.get("France"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment