Here you can find the source of getClassHierarchyLeaf( Collection
public static Class<?> getClassHierarchyLeaf( Collection<Class<?>> classes)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static Class<?> getClassHierarchyLeaf( Collection<Class<?>> classes) { Class<?> hierarchyLeaf = null; for (Class<?> clazz : classes) { if (hierarchyLeaf == null) { hierarchyLeaf = clazz;//from ww w .j a va 2 s . c o m } else if (clazz != null) { if (hierarchyLeaf.isAssignableFrom(clazz)) { hierarchyLeaf = clazz; } } } return hierarchyLeaf; } }