Here you can find the source of getClassType(Object obj)
public static int getClassType(Object obj)
//package com.java2s; //License from project: Open Source License public class Main { public static int getClassType(Object obj) { Class<?> collection = java.util.AbstractCollection.class; Class<?> map = java.util.AbstractMap.class; if (collection.isInstance(obj)) { return 1; } else if (map.isInstance(obj)) { return 2; } else {//from w w w. j av a2s. c o m return 0; } } }