Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.util.*;

public class Main {
    public static String joinMap(Map<?, ?> map) {
        if (map.isEmpty()) {
            return "";
        }
        StringBuilder stringBuilder = new StringBuilder();
        boolean notFirst = false;
        for (Map.Entry<?, ?> entry : map.entrySet()) {
            if (notFirst) {
                stringBuilder.append(',');
            }
            stringBuilder.append(entry.getKey().toString()).append(':').append(entry.getValue().toString());
            notFirst = true;
        }
        return stringBuilder.toString();
    }
}