Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Collection;
import java.util.Collections;

import javax.annotation.Nullable;

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