Iterable<OverloadDescriptor> (final ClassRepr cls, Function<? super MethodRepr, Integer> correspondenceFinder) { Function<ClassRepr, Iterable<OverloadDescriptor>> converter = c -> Iterators.filter(Iterators.map(c.getMethods(), m -> { Integer accessScope = correspondenceFinder.apply(m); return accessScope != null? new OverloadDescriptor(accessScope, m, c) : null; }), Iterators.notNullFilter()); return Iterators.flat(Iterators.flat( collectRecursively(cls, converter), Iterators.map( Iterators.flat(Iterators.map(getAllSubclasses(cls.name), subName -> subName != cls.name? reprsByName(subName, ClassRepr.class) : Collections.emptyList())), repr -> converter.apply(repr) ) )); }