Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.Collection;

public class Main {
    public static void checkContent(final Collection<?> collection, final Class<?> clazz) {
        for (final Object o : collection) {
            if (!clazz.isInstance(o)) {
                throw new IllegalArgumentException(
                        "Collection has an instance of " + o.getClass() + ", which doesn't inherit from " + clazz);
            }
        }
    }
}