Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-4313

Observable head should not return null

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Scala

      null shouldn't be returned by a Scala library. None should be returned instead. So, Observable.head could be changed to this:

      // Some comments here
        def head(): Future[T] = {
          headOption().map {
            case Some(result) => result
            case None         => None.asInstanceOf[T] 
          }(Helpers.DirectExecutionContext)
        }
      

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            scott.rice@rallyhealth.com Scott Rice
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: