Java Map to String mapToString(Map map)

Here you can find the source of mapToString(Map map)

Description

map To String

License

Open Source License

Declaration

private static String mapToString(Map<String, String> map) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

import java.util.List;
import java.util.Map;

public class Main {
    private static String mapToString(Map<String, String> map) {

        StringBuilder stringBuilder = new StringBuilder();
        if (null != map && !map.isEmpty()) {

            List<String> lst = new ArrayList<>(map.keySet());
            for (String key : lst) {

                stringBuilder.append(key + "=" + map.get(key));
                if (!key.equals(lst.get(lst.size() - 1))) {

                    stringBuilder.append("&");
                }//from   ww w. j av a  2s.  co m
            }
        }
        return stringBuilder.toString();
    }
}

Related

  1. mapToString(Map acs)
  2. mapToString(Map m)
  3. mapToString(Map map)
  4. mapToString(Map criteria)
  5. MapToString(Map map)
  6. mapToString(Map map)
  7. mapToString(Map map)
  8. mapToString(Map map)
  9. mapToString(Map map)