Here you can find the source of clone(Map, ?> configurationValues)
Parameter | Description |
---|---|
configurationValues | The config values to clone |
@SuppressWarnings({ "unchecked" }) public static Map clone(Map<?, ?> configurationValues)
//package com.java2s; /*//from ww w . ja v a2 s .c o m * Hibernate, Relational Persistence for Idiomatic Java * * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. */ import java.util.HashMap; import java.util.Map; import java.util.Properties; public class Main { /** * Make a clone of the configuration values. * * @param configurationValues The config values to clone * * @return The clone */ @SuppressWarnings({ "unchecked" }) public static Map clone(Map<?, ?> configurationValues) { if (configurationValues == null) { return null; } // If a Properties object, leverage its clone() impl if (Properties.class.isInstance(configurationValues)) { return (Properties) ((Properties) configurationValues).clone(); } // Otherwise make a manual copy HashMap clone = new HashMap(); for (Map.Entry entry : configurationValues.entrySet()) { clone.put(entry.getKey(), entry.getValue()); } return clone; } }