Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Iterator;

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

public class Main {
    /**
     * Get key value of map in String
     * 
     * @version 1.0
     * @author pankajbharti
     */
    @SuppressWarnings("rawtypes")
    public static String getKeyValue(Map map) {
        StringBuilder str = new StringBuilder("");

        Set keySet = map.entrySet();

        Iterator itr = keySet.iterator();

        while (itr.hasNext()) {
            Map.Entry entry = (Map.Entry) itr.next();

            str.append(entry.getKey() + " : " + entry.getValue() + "\n" + "\t \t \t \t \t");
        }

        return str.toString();
    }
}