Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.util.Map;

public class Main {
    public static final String toStringMap(Map map, boolean ln) {
        StringBuilder sb = new StringBuilder();
        boolean first = true;
        for (Object eo : map.entrySet()) {
            Map.Entry e = (Map.Entry) eo;
            String key = "" + e.getKey();
            String value = "" + e.getValue();
            if (!first) {
                sb.append(", ");
                if (ln)
                    sb.append("\n");
            } else {
                first = false;
            }
            sb.append(key + "=" + value);
        }
        return sb.toString();
    }
}