Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;

import java.util.List;

public class Main {
    public static <T> T last(List<T> list) {
        return list != null && !list.isEmpty() ? list.get(list.size() - 1) : null;
    }

    /**
     * @param c
     * @return size of {@link c} if c is not {@code null}, 0 otherwise
     */
    public static int size(Collection<?> c) {
        return c != null ? c.size() : 0;
    }
}