Java tutorial
//package com.java2s; /* Copyright 2004 - 2007 Kasper Nielsen <kasper@codehaus.org> Licensed under * the Apache 2.0 License, see http://coconut.codehaus.org/license. */ import java.util.Collection; public class Main { static void checkCollectionForNulls(Collection<?> col) { for (Object entry : col) { if (entry == null) { throw new NullPointerException("collection contains a null entry"); } } } }