Java Properties Get copyProperties(Hashtable src, Hashtable target)

Here you can find the source of copyProperties(Hashtable src, Hashtable target)

Description

This API copies the properties from src hashtable to the target hashtable

License

Open Source License

Parameter

Parameter Description
src specifies the source hashtable from which properties should be copied.
target specifies the target hashtable to which properties should be copied.

Declaration

public static void copyProperties(Hashtable src, Hashtable target) 

Method Source Code

//package com.java2s;
/*/*w ww . j  a v  a  2  s  .c o m*/
 * Copyright (c) Fiorano Software Pte. Ltd. and affiliates. All rights reserved. http://www.fiorano.com
 * The software in this package is published under the terms of the CPAL v1.0
 * license, a copy of which has been included with this distribution in the
 * LICENSE.txt file.
 */

import java.util.*;

public class Main {
    /**
     * This API copies the properties from src hashtable to the target hashtable
     *
     * @param src    specifies the source hashtable from which properties should be copied.
     * @param target specifies the target hashtable to which properties should be copied.
     */
    public static void copyProperties(Hashtable src, Hashtable target) {
        // get all the keys of the source table.
        Enumeration keys = src.keys();

        // put all the keys from the source to destination table
        while (keys.hasMoreElements()) {
            // get the next key
            Object key = keys.nextElement();

            // get the value
            Object value = src.get(key);

            // put the value in the target table
            target.put(key, value);
        }
    }
}

Related

  1. clearPrefixedSystemProperties(String prefix, Map targetPropertyMap)
  2. getBoolean(Properties props, String key)
  3. getBoolean(Properties props, String name, boolean defaultValue)
  4. getInt(Properties props, String name)
  5. getInt(Properties props, String name, int defaultValue)