Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Map;

public class Main {
    public static <K> void aggregateMaps(Map<K, Integer> A, Map<K, Integer> B) {
        for (K k : B.keySet()) {
            if (A.containsKey(k))
                A.put(k, A.get(k) + B.get(k));
            else
                A.put(k, B.get(k));
        }
    }
}