Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Collections;

import java.util.Map;

import javax.annotation.Nullable;

public class Main {
    /**
     * Returns an non null value based on the giving {@link Map}
     *
     * @param map
     *            value to evaluate
     * @return the original value or an empty {@link Map}
     * @since 4.2
     */
    public static <K, V> Map<K, V> nonNullMap(@Nullable final Map<K, V> map) {
        return map == null ? Collections.emptyMap() : map;
    }
}