Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.List;

public class Main {
    private static final Class PRIMITIVE_TYPE_LIST = List.class;

    public static boolean isList(Class clazz) {
        return isSubclassOf(clazz, PRIMITIVE_TYPE_LIST);
    }

    public static boolean isSubclassOf(Class clazz, Class what) {
        while (clazz != null) {
            if (clazz == what)
                return true;

            clazz = clazz.getSuperclass();
        }

        return false;
    }
}