Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.*;

public class Main {
    /**
     *  Get the first item in a list.  If there is no such item, return
     *  null.
     */
    public static <T> T first(Collection<T> list) {
        if (list == null || list.isEmpty())
            return null;

        return list.iterator().next();
    }
}