I have a java method that should check through an ArrayList and check if it contains an instance of a given class. I need to pass the method the type of class to check for a
public static T find(Collection> arrayList, Class clazz)
{
for(Object o : arrayList)
{
if (o != null && o.getClass() == clazz)
{
return clazz.cast(o);
}
}
return null;
}