print Map - Java java.util

Java examples for java.util:Map Operation

Description

print Map

Demo Code


//package com.java2s;

import java.util.Iterator;

import java.util.Map;
import java.util.Map.Entry;

public class Main {
    public static void printMap(Map map) {
        Iterator itr = map.entrySet().iterator();
        for (; itr.hasNext();) {
            Entry e = (Entry) itr.next();
            System.out.println("key:" + e.getKey().toString() + "  value:"
                    + e.getValue().toString());
        }//  w w  w .j a v  a2 s. co  m
    }
}

Related Tutorials