Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-336

Unnecessary null checks in equals methods

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 2.1
    • None
    • None

    Description

      Many of the equals() methods have code like the following:

      if (obj == null) {
          return false;
      }
      if (!(obj instanceof OpenMapRealVector)) {
          return false;
      }
      

      The null check is redundant, as null would cause the instanceof check to fail anyway, so the null check could just be removed.

      Attachments

        Activity

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: