Returning null as Optional from FindSink.OfRef

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P5
    • None
    • Affects Version/s: None
    • Component/s: core-libs

      SonarCloud reports an oddity in `java.util.stream.FindOps.FindSink.OfRef.get()`

      ```
                  @Override
                  public Optional<T> get() {
                      return hasValue ? Optional.of(value) : null;
                  }
      ```

      The method return type is Optional, but it returns `null`.

      Looks like a minor overlook, as similar code in ReduceOps returns Optional.empty(). There might be other implications to this.

            Assignee:
            Aleksey Shipilev
            Reporter:
            Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: