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

Observable head should not return null

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Works as Designed
    • Icon: Unknown Unknown
    • None
    • None
    • Scala

    Description

      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)
        }
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: