Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8011800

Add java.util.Objects.requireNonNull(T, Supplier<String>)

XMLWordPrintable

    • b87
    • generic
    • generic
    • Verified

      In JDK 7, java.util.Objects included several methods to check for null, including one that took a message to return if a null was found. With lambdas in JDK 8, another variant to include is a requireNonNull method which takes a string supplier instead of a string. That why the cost of creating the string message can be avoided for the non-null case. Note that the lambda capture can have a nonzero cost though.

            darcy Joe Darcy
            darcy Joe Darcy
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: