TraceInfo (@NotNull StreamCall call, @NotNull Value value) { if (value instanceof ArrayReference) { final Value peeksResult = ((ArrayReference)value).getValue(0); final TraceInfo peekInfo = myPeekResolver.resolve(call, peeksResult); final Map<Integer, TraceElement> before = peekInfo.getValuesOrderBefore(); final Value optionalTrace = ((ArrayReference)value).getValue(1); final Value optionalValue = getOptionalValue(optionalTrace); if (optionalValue == null) { return new ValuesOrderInfo(call, before, Collections.emptyMap()); } final TraceElementImpl element = new TraceElementImpl(Integer.MAX_VALUE - 1, optionalValue); return new ValuesOrderInfo(call, before, Collections.singletonMap(element.getTime(), element)); } throw new UnexpectedValueException("trace termination with optional result must be an array value"); }