Here you can find the source of getNextNullIndex(C collection)
public static <C extends Collection> int getNextNullIndex(C collection) throws Exception
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { public static <C extends Collection> int getNextNullIndex(C collection) throws Exception { int output = -1; int currentLoc = 0; for (Object object : collection) { if (object == null) { output = currentLoc;// w ww. j a v a 2 s .c o m break; } currentLoc++; } if (output != -1) { throw new Exception("Collection is full."); } else { return output; } } }