Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Map;

import java.util.SortedSet;
import java.util.TreeSet;

public class Main {
    public static <K, V extends Comparable<V>> void addToValueSortedSet(Map<K, SortedSet<V>> map, K key, V value) {
        SortedSet<V> values = map.get(key);
        if (values == null) {
            values = new TreeSet<V>();
            map.put(key, values);
        }
        values.add(value);
    }
}