Result (@NotNull TraceInfo info) { final Map<Integer, TraceElement> before = info.getValuesOrderBefore(); final Map<Integer, TraceElement> after = info.getValuesOrderAfter(); assert after.size() == 1; final TraceElement resultElement = after.values().iterator().next(); final List<TraceElement> to = Collections.singletonList(resultElement); final Map<TraceElement, List<TraceElement>> forward = new LinkedHashMap<>(); for (final TraceElement beforeElement : before.values()) { forward.put(beforeElement, to); } final Map<TraceElement, List<TraceElement>> backward = Collections.singletonMap(resultElement, new ArrayList<>(before.values())); return Result.of(forward, backward); }