Uploaded image for project: 'OpenFlowPlugin'
  1. OpenFlowPlugin
  2. OPNFLWPLUG-1066

Inappropriate use of Objects.isNull() and Objects.nonNull()

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Medium Medium
    • Sodium
    • None
    • General
    • None

      The codebase currently uses the following idiom

      Object foo;
      if (Objects.isNull(foo)) {
          // ...
      }
      

      While this works, it is a misuse of these two methods, which are documented as:

      API Note:
      This method exists to be used as a Predicate, filter(Objects::isNull)

      It also has two down sides:

       

            rovarga Robert Varga
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: