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, V> V setDefault(Map<K, V> map, K key, V value) {

        V _value = map.get(key);
        if (_value != null)
            return _value;
        else {
            map.put(key, value);
            return value;
        }

    }
}