Here you can find the source of containsType(List> list, Class type)
public static boolean containsType(List<?> list, Class type)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static boolean containsType(List<?> list, Class type) { return (indexOfType(list, type) != -1); }//from ww w . j a va 2s.c o m public static int indexOfType(List<?> list, Class type) { for (int idx = 0; idx < list.size(); idx++) { if (type.isInstance(list.get(idx))) { return idx; } } return -1; } }