Java Map Copy copySafelyToObjectToObjectMap(java.util.Map map)

Here you can find the source of copySafelyToObjectToObjectMap(java.util.Map map)

Description

copy Safely To Object To Object Map

License

Open Source License

Declaration

public static java.util.Map<Object, Object> copySafelyToObjectToObjectMap(java.util.Map<?, ?> map) 

Method Source Code

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

public class Main {
    public static java.util.Map<Object, Object> copySafelyToObjectToObjectMap(java.util.Map<?, ?> map) {
        java.util.Map<Object, Object> castedCopy = new java.util.LinkedHashMap<Object, Object>();

        if (map == null) {
            return castedCopy;
        }/*ww w .  j  a v a 2s .  com*/

        java.util.Iterator<?> it = map.keySet().iterator();
        while (it.hasNext()) {
            Object nextKey = it.next();
            castedCopy.put(nextKey, map.get(nextKey));
        }
        return castedCopy;
    }
}

Related

  1. copyOf(Map src)
  2. copyOnWritePut(K k, V v, Map source)
  3. copyOptions(Map options)
  4. copyParameters(Map parameters)
  5. copyPropertiesToMap(Properties source, Map target)
  6. copyStringMap(Map initParams)
  7. copyUntilFull(final Map source, final Map dest1, Map overflow, final int dest1Capacity)
  8. copyValue(Map source, Map target, K key)
  9. copyValueIfExist(Map source, K sourceKey, Map target, K targetKey)