Java Map Copy copyLowerCaseMap(Map map)

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

Description

copy Lower Case Map

License

Apache License

Parameter

Parameter Description
map HashMap from a RETS transaction

Return

keyMap with keys in lowercase

Declaration


public static Map<String, Object> copyLowerCaseMap(Map<?, ?> map) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    /**/*from  w  ww .  jav  a  2  s. co m*/
     * 
     * @param map
     *            HashMap from a RETS transaction
     * 
     * @return keyMap with keys in lowercase
     */

    public static Map<String, Object> copyLowerCaseMap(Map<?, ?> map) {
        if (map == null) {
            return null;
        }
        HashMap<String, Object> keyMap = new HashMap<String, Object>();
        Iterator<?> keys = map.keySet().iterator();
        while (keys.hasNext()) {
            String key = (String) keys.next();
            Object value = map.get(key);
            if (key != null) {
                key = key.toLowerCase();
            }
            keyMap.put(key, value);
        }
        return keyMap;
    }
}

Related

  1. copyAndRemove(Map map, K key)
  2. copyDeep(Map> data)
  3. copyEntries(Map aSource, Map aTarget)
  4. copyExcludingKeys(Map map, Set excludedKeys)
  5. copyHashMap(HashMap map1, HashMap map2)
  6. copyMap(Map from, Map to)
  7. copyMap(Map sourceMap, Map targetMap)
  8. copyMap(Map m)
  9. copyMap(Map m)