Here you can find the source of containsOnlyNulls(List
public static <T> boolean containsOnlyNulls(List<T> list)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static <T> boolean containsOnlyNulls(List<T> list) { for (T t : list) if (t != null) return false; return true; }//ww w. ja v a2 s . com }