use StreamEx.ofTree

This commit is contained in:
Egor.Ushakov
2016-10-28 15:52:02 +03:00
parent 94b4385ef1
commit e76af49fc2
@@ -510,10 +510,6 @@ public class MethodBreakpoint extends BreakpointWithHighlighter<JavaMethodBreakp
private static void processSubTypes(ReferenceType classType, Consumer<ReferenceType> consumer) {
MultiMap<ReferenceType, ReferenceType> inheritance = new MultiMap<>();
classType.virtualMachine().allClasses().forEach(type -> supertypes(type).forEach(st -> inheritance.putValue(st, type)));
subtypes(classType, inheritance).forEach(consumer);
}
private static Stream<ReferenceType> subtypes(ReferenceType type, MultiMap<ReferenceType, ReferenceType> inheritance) {
return StreamEx.of(type).append(StreamEx.of(inheritance.get(type)).flatMap(t -> subtypes(t, inheritance)));
StreamEx.ofTree(classType, t -> StreamEx.of(inheritance.get(t))).forEach(consumer);
}
}