getElements

fun <T> getElements(objects: List<*>, targetClass: Class<T>): List<T>

Returns a list of the elements that are of the same type as the target class. Usage: getElements(objects, String.class);

Return

a list that holds the items of the targetClass

Parameters

the type of the element to search for
objects

the list that can hold anything

targetClass

the class type to find in the list, should be same as T