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.*;

public class Main {
    public static <T> String printMapWithDelimiter(Map<T, T> map, String delimiter) {
        boolean first = true;
        StringBuilder sb = new StringBuilder();
        for (Map.Entry<T, T> entry : map.entrySet()) {
            if (first)
                first = false;
            else
                sb.append(delimiter);
            sb.append(entry.getKey()).append("=").append(entry.getValue());
        }
        return sb.toString();
    }
}