Here you can find the source of containsInstance(final List
public static <E> boolean containsInstance(final List<E> list, final Class<? extends E> clazz)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static <E> boolean containsInstance(final List<E> list, final Class<? extends E> clazz) { return list.stream().anyMatch(e -> clazz.isInstance(e)); }//from w w w . j a va 2 s . c o m }