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.Set;

import javax.annotation.Nullable;

public class Main {
    /**
     * Returns an non null value based on the giving {@link Set}
     *
     * @param set
     *            value to evaluate
     * @return the original value or an empty {@link Set}
     * @since 4.2
     */
    public static <T> Set<T> nonNullSet(@Nullable final Set<T> set) {
        return set == null ? Collections.emptySet() : set;
    }
}