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

import javax.annotation.Nullable;

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