The putAll(Map extends k,? extends v> m) method is used to copy all of the mappings from the specified map to this map.
Syntax:public void putAll(Map extends k,? extends v> m)
Example:package com.technicia;
import java.util.*;
public class HashMapDemo {
public static void main(String args[]) {
// create two hash maps
HashMap newmap1 = new HashMap();
HashMap newmap2 = new HashMap();
// populate hash map
newmap1.put(1, "tutorials");
newmap1.put(2, "point");
newmap1.put(3, "is best");
System.out.println("Values in newmap1: "+ newmap1);
// put all values in newmap2
newmap2.putAll(newmap1);
System.out.println("Values in newmap2: "+ newmap2);
}
License.
All information of this service is derived from the free sources and is provided solely in the form of quotations.
This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 309 / 158769166. Delta: 0.02759 с