Here you can find the source of countNonNull(Collection
public static int countNonNull(Collection<Double> dist)
//package com.java2s; import java.util.Collection; public class Main { public static int countNonNull(Collection<Double> dist) { int count = 0; for (Double val : dist) { if (val != null) { count++;/* w w w. j ava2 s. c o m*/ } } return count; } }