void putContinuations(Map<String, Continuation> out) {
            if (max > 0) {
                if (firstEntry > 0) {
                    continuation.add(new OffsetContinuation(resultId, tag, firstEntry, 0));

                    int prevPage = Math.max(0, Math.min(firstEntry, lastEntry) - max);
                    out.put(Continuation.PREV_PAGE, new OffsetContinuation(resultId, tag, prevPage,
                                                                           OffsetContinuation.FLAG_UNSTABLE));
                }
                if (lastEntry < numEntries) {
                    out.put(Continuation.NEXT_PAGE, new OffsetContinuation(resultId, tag, lastEntry,
                                                                           OffsetContinuation.FLAG_UNSTABLE));
                }
            }
        }
Constructs the grouping result tree that corresponds to the parameters given to this builder. This method might
fail due to unsupported constructs in the results, in which case an exception is thrown.

@throws IllegalInputException Thrown if the grouping result contains unsupported constructs.
container-search/src/main/java/com/yahoo/search/grouping/vespa/ResultBuilder.java