Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.IdentityHashMap;

public class Main {
    public static void main(String args[]) {

        IdentityHashMap<Integer, String> ihmap1 = new IdentityHashMap<Integer, String>();
        IdentityHashMap<Integer, String> ihmap2 = new IdentityHashMap<Integer, String>();

        // populate the ihmap1
        ihmap1.put(1, "from");
        ihmap1.put(2, "java2s.com");
        ihmap1.put(3, "tutorial");

        System.out.println("Value of ihmap1 before: " + ihmap1);
        System.out.println("Value of ihmap2 before: " + ihmap2);

        // put all values from ihmap1 to ihmap2
        ihmap2.putAll(ihmap1);

        System.out.println("Value of ihmap2 after: " + ihmap2);
    }
}