void (@NotNull Set<TraceElement> prev, @NotNull Set<TraceElement> next, @NotNull Function<? super TraceElement, ? extends List<TraceElement>> toNext, @NotNull Function<? super TraceElement, ? extends List<TraceElement>> toPrev) { for (final TraceElement leftElement : prev) { final List<TraceElement> mapToRight = toNext.apply(leftElement); for (final TraceElement rightElement : mapToRight) { assertTrue(next.contains(rightElement)); assertTrue(toPrev.apply(rightElement).contains(leftElement)); } } }