Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.HashMap;

import java.util.Iterator;

import java.util.Map;
import java.util.Set;

public class Main {
    /**
     * HashMap Operations
     * */
    public static void printHash(HashMap<String, Integer> hashMap) {
        System.out.println("Print HashMap");
        Set<Map.Entry<String, Integer>> s = hashMap.entrySet();
        Iterator<Map.Entry<String, Integer>> it = s.iterator();
        while (it.hasNext()) {
            Map.Entry<String, Integer> m = (Map.Entry<String, Integer>) it.next();
            System.out.println(m.getKey() + "\t" + m.getValue());
        }
    }
}