Here you can find the source of copyEntries(Map aSource, Map aTarget)
Parameter | Description |
---|---|
aSource | source entry map |
aTarget | target entry map |
public static void copyEntries(Map aSource, Map aTarget)
//package com.java2s; /*// ww w . jav a2 s. com * Copyright (c) 2004-2006 Active Endpoints, Inc. * * This program is licensed under the terms of the GNU General Public License * Version 2 (the "License") as published by the Free Software Foundation, and * the ActiveBPEL Licensing Policies (the "Policies"). A copy of the License * and the Policies were distributed with this program. * * The License is available at: * http: *www.gnu.org/copyleft/gpl.html * * The Policies are available at: * http: *www.activebpel.org/licensing/index.html * * Unless required by applicable law or agreed to in writing, this program is * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS * OF ANY KIND, either express or implied. See the License and the Policies * for specific language governing the use of this program. */ import java.util.HashMap; import java.util.Iterator; import java.util.Map; public class Main { /** * Recursively copies config entry map from the source to the target. * @param aSource source entry map * @param aTarget target entry map */ public static void copyEntries(Map aSource, Map aTarget) { for (Iterator iter = aSource.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); Object key = entry.getKey(); Object value = entry.getValue(); if (value instanceof Map) { Map newCopy = new HashMap(); copyEntries((Map) value, newCopy); aTarget.put(key, newCopy); } else { aTarget.put(key, value); } } } }