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 { /** * Checks whether or not the specified collection contains a <code>null</code>. * * @param col * the collection to check * @throws NullPointerException * if the specified collection contains a null */ public static void checkCollectionForNulls(Collection<?> col) { for (Object entry : col) { if (entry == null) { throw new NullPointerException("collection contains a null entry"); } } } }