Java tutorial
//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, Long> convertMapValueToLong(Map<K, String> map) { Map<K, Long> covertedResult = new HashMap<K, Long>(map.size()); Set<Entry<K, String>> entrySet = map.entrySet(); for (Entry<K, String> entry : entrySet) { covertedResult.put(entry.getKey(), Long.valueOf(entry.getValue().trim())); } return covertedResult; } }