Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.HashMap;

import java.util.Map;
import java.util.Map.Entry;

public class Main {

    public static Map<String, String> convertMap(Map<String, String[]> srcMap) {
        Map<String, String> aimMap = new HashMap<String, String>();
        for (Entry<String, String[]> entry : srcMap.entrySet()) {
            String[] srcValue = entry.getValue();
            String aimValue = srcValue != null && srcValue.length > 0 ? srcValue[0] : null;
            aimMap.put(entry.getKey(), aimValue);
        }
        return aimMap;
    }
}