Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.ArrayList;

import java.util.List;
import java.util.Map;

public class Main {
    public static <K, V> void appendToMultiMap(final Map<K, List<V>> mm, final K key, final V value) {
        List<V> values = mm.get(key);
        if (values == null) {
            values = new ArrayList<V>();
            mm.put(key, values);
        }
        values.add(value);
    }
}