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.Set;
import java.util.Map.Entry;

public class Main {
    public static <K> Map<K, String> trimMapValue(Map<K, String> map) {
        Map<K, String> covertedResult = new HashMap<K, String>(map.size());

        Set<Entry<K, String>> entrySet = map.entrySet();
        for (Entry<K, String> entry : entrySet) {
            covertedResult.put(entry.getKey(), entry.getValue().trim());
        }
        return covertedResult;
    }
}