Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Collection;

public class Main {
    /**
     * Returns the size of the specified collection or 0 on null.
     * @param <T>
     * @param collection
     * @return
     */
    public static <T> int size(Collection<T> collection) {
        return collection == null ? 0 : collection.size();
    }
}