Java Utililty Methods Map Clone

List of utility methods to do Map Clone

  1. HOME
  2. Java
  3. M
  4. Map Clone

Description

The list of methods to do Map Clone are organized into topic(s).

Method

Map clone(Map aMap)
Clones a map.
if (aMap instanceof HashMap)
 return (Map) ((HashMap) aMap).clone();
if (aMap instanceof Hashtable)
 return (Map) ((Hashtable) aMap).clone();
return aMap == null ? null : new HashMap(aMap);
Map clone(Map from, Map to)
clone
Iterator keyIt = from.keySet().iterator();
while (keyIt.hasNext()) {
 Object key = keyIt.next();
 Object value = from.get(key);
 to.put(key, value);
return to;
Map clone(Map configurationValues)
Make a clone of the configuration values.
if (configurationValues == null) {
 return null;
if (Properties.class.isInstance(configurationValues)) {
 return (Properties) ((Properties) configurationValues).clone();
HashMap clone = new HashMap();
for (Map.Entry entry : configurationValues.entrySet()) {
...
Map clone(Map map1)
clone
Map<K, V> map2 = new HashMap<K, V>(map1.size());
for (Map.Entry<K, V> e : map1.entrySet()) {
 map2.put(e.getKey(), e.getValue());
return map2;
HashMap clone(Map origMap)
returns a new HashMap containing a shallow clone of the original map.
HashMap<K, V> newMap = new HashMap<K, V>();
if (origMap != null && origMap.size() > 0) {
 newMap.putAll(origMap);
return newMap;
Map clone(Map map)
clone
if (map.isEmpty()) {
 return Collections.emptyMap();
Map<String, String[]> copy = new HashMap<String, String[]>(map);
for (Map.Entry<String, String[]> entry : copy.entrySet()) {
 entry.setValue(entry.getValue().clone());
return copy;
...
Map cloneDefaults(Map defaults)
clone Defaults
Map<String, Object> cloned = new HashMap<String, Object>();
for (Map.Entry entry : defaults.entrySet()) {
 cloned.put((String) entry.getKey(), entry.getValue());
return cloned;
Map cloneMap(final Map m)
clone Map
if (m == null) {
 return null;
final Map<String, Object> ret = new HashMap<String, Object>(m.size());
for (final Entry<String, Object> e : m.entrySet()) {
 ret.put(String.valueOf(e.getKey()), e.getValue());
return ret;
...
Map cloneMap(Map map)
Creates a duplicate of the specified map
Map<K, V> tempUpdates = new HashMap<K, V>();
tempUpdates.putAll(map);
return tempUpdates;
Map cloneMap(Map orig)
Shallow clone
if (orig == null) {
 return null;
Map<K, V> clone = new HashMap<K, V>();
for (Entry<K, V> origEntry : orig.entrySet()) {
 clone.put(origEntry.getKey(), origEntry.getValue());
return clone;
...


AltStyle によって変換されたページ (->オリジナル) /