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

Unnecessary null checks in equals methods

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.1
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: