boolean (@NotNull Stub stub, @NotNull Stub stub2) { if (stub.getStubType() != stub2.getStubType()) { return false; } List<? extends Stub> stubs = stub.getChildrenStubs(); List<? extends Stub> stubs2 = stub2.getChildrenStubs(); if (stubs.size() != stubs2.size()) { return false; } for (int i = 0, len = stubs.size(); i < len; ++i) { if (!areStubsSimilar(stubs.get(i), stubs2.get(i))) { return false; } } return true; }