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 {
    public static <T> int countNotNull(Collection<T> objects) {
        return objects.size() - countNull(objects);
    }

    public static <T> int countNull(Collection<T> objects) {
        int count = 0;
        for (Object o : objects)
            if (o == null)
                count++;
        return count;
    }
}