Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.support.annotation.Nullable;

import java.util.List;

public class Main {
    /**
     * Returns first item in the list if list is not empty.
     *
     * @param list The list to get first item from.
     */
    @Nullable
    public static <T> T first(@Nullable final List<T> list) {
        return (list == null || list.isEmpty() ? null : list.get(0));
    }
}