From 012a6ed4fcc24ca8a75afff0986ff672f18a779c Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Sun, 14 Mar 2010 01:35:14 +0000 Subject: [PATCH] MATH-336 Unnecessary null checks in equals methods git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@922714 13f79535-47bb-0310-9956-ffa450edef68 --- .../commons/math/analysis/polynomials/PolynomialFunction.java | 2 -- .../org/apache/commons/math/linear/OpenMapRealVector.java | 3 --- .../org/apache/commons/math/linear/SparseFieldVector.java | 4 ---- .../math/stat/descriptive/moment/VectorialCovariance.java | 2 -- .../commons/math/stat/descriptive/moment/VectorialMean.java | 2 -- 5 files changed, 13 deletions(-) diff --git a/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java b/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java index fde8fbb97..d5e70445c 100644 --- a/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java +++ b/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java @@ -341,8 +341,6 @@ public class PolynomialFunction implements DifferentiableUnivariateRealFunction, public boolean equals(Object obj) { if (this == obj) return true; - if (obj == null) - return false; if (!(obj instanceof PolynomialFunction)) return false; PolynomialFunction other = (PolynomialFunction) obj; diff --git a/src/main/java/org/apache/commons/math/linear/OpenMapRealVector.java b/src/main/java/org/apache/commons/math/linear/OpenMapRealVector.java index 43b926aa2..fe7a6ca9e 100644 --- a/src/main/java/org/apache/commons/math/linear/OpenMapRealVector.java +++ b/src/main/java/org/apache/commons/math/linear/OpenMapRealVector.java @@ -778,9 +778,6 @@ public class OpenMapRealVector extends AbstractRealVector implements SparseRealV if (this == obj) { return true; } - if (obj == null) { - return false; - } if (!(obj instanceof OpenMapRealVector)) { return false; } diff --git a/src/main/java/org/apache/commons/math/linear/SparseFieldVector.java b/src/main/java/org/apache/commons/math/linear/SparseFieldVector.java index 4925dc41c..f9421c496 100644 --- a/src/main/java/org/apache/commons/math/linear/SparseFieldVector.java +++ b/src/main/java/org/apache/commons/math/linear/SparseFieldVector.java @@ -615,10 +615,6 @@ public class SparseFieldVector> implements FieldVector return true; } - if (obj == null) { - return false; - } - if (!(obj instanceof SparseFieldVector)) { return false; } diff --git a/src/main/java/org/apache/commons/math/stat/descriptive/moment/VectorialCovariance.java b/src/main/java/org/apache/commons/math/stat/descriptive/moment/VectorialCovariance.java index 308098113..63a495dfa 100644 --- a/src/main/java/org/apache/commons/math/stat/descriptive/moment/VectorialCovariance.java +++ b/src/main/java/org/apache/commons/math/stat/descriptive/moment/VectorialCovariance.java @@ -135,8 +135,6 @@ public class VectorialCovariance implements Serializable { public boolean equals(Object obj) { if (this == obj) return true; - if (obj == null) - return false; if (!(obj instanceof VectorialCovariance)) return false; VectorialCovariance other = (VectorialCovariance) obj; diff --git a/src/main/java/org/apache/commons/math/stat/descriptive/moment/VectorialMean.java b/src/main/java/org/apache/commons/math/stat/descriptive/moment/VectorialMean.java index b4b18b19a..025341abe 100644 --- a/src/main/java/org/apache/commons/math/stat/descriptive/moment/VectorialMean.java +++ b/src/main/java/org/apache/commons/math/stat/descriptive/moment/VectorialMean.java @@ -92,8 +92,6 @@ public class VectorialMean implements Serializable { public boolean equals(Object obj) { if (this == obj) return true; - if (obj == null) - return false; if (!(obj instanceof VectorialMean)) return false; VectorialMean other = (VectorialMean) obj;