Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class Main {
    public static <K, V> Map<K, Set<V>> groupByKeyEmpty(List<K> keys) {
        Map<K, Set<V>> map = new HashMap<K, Set<V>>();
        for (K key : keys) {
            if (!map.containsKey(key)) {
                map.put(key, new HashSet<V>());
            }
        }
        return map;
    }
}