Here you can find the source of isCollectionType(Object obj)
Parameter | Description |
---|---|
obj | the object to check what type it is |
static boolean isCollectionType(Object obj)
//package com.java2s; import java.util.Collection; import java.util.List; public class Main { /**//from ww w .j a va 2 s .c o m * This method checks whether the JSON being parse is a container class. This * prevents malforming the returning JSON string. * @param obj the object to check what type it is * @return true if it is a container class, false otherwise */ static boolean isCollectionType(Object obj) { if (obj instanceof List<?>) { return true; } else if (obj instanceof Collection<?>) { return true; } // add other statements here return false; } }