Hash Mapper - II

package hashmapper2;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

/**
 *
 * @author Nurhak
 */
public class HashMapper2 {

    private static HashMap hm = new HashMap();

    public static void main(String[] args) {

        hm.put("England", "London");
        hm.put("Italy", "Rome");
        hm.put("Turkey", "Ankara");
        hm.put("Germany", "Berlin");
        hm.put("Greece", "Athens");
        hm.put("Spain", "Madrid");
        hm.put("Czech Republic", "Prague");
        hm.put("Belgium", "Brussels");
        hm.put("Holland", "Amsterdam");

        Set s = hm.keySet();
        Iterator countries = s.iterator();
        while (countries.hasNext()) {
            Object country = countries.next();
            System.out.println("Country name: " + country);
        }

        Collection c = hm.values();
        Iterator capitals = c.iterator();
        while (capitals.hasNext()) {
            Object capital = capitals.next();
            System.out.println("Capital name: " + capital);
        }

    }
}

Comments

Popular posts from this blog

Solution for the fault: "System.Diagnostics.Process.Start is not working on IIS, but working on ASP.NET Development Server"

Solution for "Can not obtain Oracle client information from registry"