hashtable Merge - Java java.util

Java examples for java.util:Hashtable Operation

Description

hashtable Merge

Demo Code


//package com.java2s;

import java.util.Enumeration;
import java.util.Hashtable;

public class Main {
    static Hashtable hashtableMerge(Hashtable dst, Hashtable src) {
        if (dst == null)
            return src;
        if (src == null)
            return dst;

        Enumeration e = src.keys();

        while (e.hasMoreElements()) {
            Object element = e.nextElement();
            dst.put(element, src.get(element));
        }//w  ww  .j  a va 2 s . c om
        return dst;
    }
}

Related Tutorials