LeastSquareResults { @Override public int hashCode() { final int prime = 31; int result = 1; long temp; temp = Double.doubleToLongBits(_chiSq); result = prime * result + (int) (temp ^ (temp >>> 32)); result = prime * result + _covariance.hashCode(); result = prime * result + _parameters.hashCode(); result = prime * result + (_inverseJacobian == null ? 0 : _inverseJacobian.hashCode()); return result; } LeastSquareResults(LeastSquareResults from);  LeastSquareResults(final double chiSq, final DoubleMatrix1D parameters, final DoubleMatrix2D covariance);  LeastSquareResults(final double chiSq, final DoubleMatrix1D parameters, final DoubleMatrix2D covariance, final DoubleMatrix2D inverseJacobian); @Override String toString(); double getChiSq(); DoubleMatrix1D getFitParameters(); DoubleMatrix2D getCovariance(); DoubleMatrix2D getFittingParameterSensitivityToData(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void testHashCode() { LeastSquareResults ls1 = new LeastSquareResults(1.0, PARAMS, COVAR); LeastSquareResults ls2 = new LeastSquareResults(1.0, new DoubleMatrix1D(new double[] {1.0, 2.0 }), new DoubleMatrix2D(new double[][] { {0.1, 0.2 }, {0.2, 0.3 } })); assertEquals(ls1.hashCode(), ls2.hashCode(), 0); ls2 = new LeastSquareResults(1.0, new DoubleMatrix1D(new double[] {1.0, 2.0 }), new DoubleMatrix2D(new double[][] { {0.1, 0.2 }, {0.2, 0.3 } }), null); assertEquals(ls1.hashCode(), ls2.hashCode(), 0); ls1 = new LeastSquareResults(1.0, PARAMS, COVAR, INV_JAC); ls2 = new LeastSquareResults(1.0, new DoubleMatrix1D(new double[] {1.0, 2.0 }), new DoubleMatrix2D(new double[][] { {0.1, 0.2 }, {0.2, 0.3 } }), new DoubleMatrix2D(new double[][] { {0.5, 0.6 }, {0.7, 0.8 } })); assertEquals(ls1.hashCode(), ls2.hashCode(), 0); }