code: @NotNull
      public OptionalDouble findSingle() {
          if (!iterator.hasNext()) {
              return OptionalDouble.empty();
          }
  
          final double singleCandidate = iterator.nextDouble();
          if (iterator.hasNext()) {
              throw new IllegalStateException("DoubleStream contains more than one element");
          }
          return OptionalDouble.of(singleCandidate);
      }
docs: Returns the single element wrapped by {@code OptionalDouble} class.
  If stream is empty, returns {@code OptionalDouble.empty()}.
  If stream contains more than one element, throws {@code IllegalStateException}.
  
  <p>This is a short-circuiting terminal operation.
  
  <p>Example:
  <pre>
  stream: []
  result: OptionalDouble.empty()
  
  stream: [1]
  result: OptionalDouble.of(1)
  
  stream: [1, 2, 3]
  result: IllegalStateException
  </pre>
  
  @return an {@code OptionalDouble} with single element
  or {@code OptionalDouble.empty()} if stream is empty
  @throws IllegalStateException if stream contains more than one element