×

Welcome to TagMyCode

Please login or create account to add a snippet.
2
0
 
0
Language: Java
Posted by: Cuong Vo
Added: May 9, 2013 9:09 AM
Modified: May 20, 2013 2:31 AM
Views: 58
  1. import java.util.Map;
  2. import org.apache.commons.lang.ArrayUtils;
  3.  
  4. public class Main {
  5.  
  6.   public static void main(String[] args) {
  7.     String[][] countries = { { "United States", "New York" }, { "United Kingdom", "London" },
  8.         { "Netherland", "Amsterdam" }, { "Japan", "Tokyo" }, { "France", "Paris" } };
  9.  
  10.     Map countryCapitals = ArrayUtils.toMap(countries);
  11.  
  12.     System.out.println("Capital of Japan is " + countryCapitals.get("Japan"));
  13.     System.out.println("Capital of France is " + countryCapitals.get("France"));
  14.   }
  15. }