@Override
    public OptionalDouble average() {
        assertNotLinkedOrConsumedAndSet();
        return finallyCloseReference(() -> streamTerminator.average(pipeline()));
    }
{@inheritDoc}

<p>
N.B. This method may short-circuit operations in the Stream pipeline and
closes the stream automatically when a terminal operation is performed.
runtime-parent/runtime-core/src/main/java/com/speedment/runtime/core/internal/stream/builder/LongStreamBuilder.java