class ComposeStackUtil {

    public static Object findAncestorWithClass(Deque<Object> composeStack, Class<?> clazz) {
        for (Object obj : composeStack) {
            if (clazz.isAssignableFrom(obj.getClass())) {
                return obj;
            }
        }

        return null;
    }

    private  ComposeStackUtil();

}