Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
// it under the terms of the GNU General Public License as published by

import java.util.Collection;
import java.util.Iterator;

public class Main {
    public static <T> void cleanNulls(Collection<T> c) {
        Iterator<T> it = c.iterator();
        try {
            while (it.hasNext())
                if (it.next() == null)
                    c.remove(null);
        } catch (NullPointerException e) {
            // Does not permit nulls, it should be ok
        }
    }
}