replaced inefficient use of constructors for Integer, Long, Float and Double

by the recommended static valueOf methods that cache results

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/branches/MATH_2_0/src/experimental@666292 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Luc Maisonobe 2008-06-10 19:32:52 +00:00
parent 0001c6749f
commit 5a49429ec7
3 changed files with 14 additions and 14 deletions

View File

@ -145,19 +145,19 @@ public class DefaultContext implements EvaluationContext {
}
DefaultValue(double d) {
value = new Double(d);
value = Double.valueOf(d);
}
DefaultValue(float f) {
value = new Float(f);
value = Float.valueOf(f);
}
DefaultValue(int i) {
value = new Integer(i);
value = Integer.valueOf(i);
}
DefaultValue(long l) {
value = new Long(l);
value = Long.valueOf(l);
}
/* (non-Javadoc)

View File

@ -134,7 +134,7 @@ public class BeanListUnivariateImpl extends ListUnivariateImpl implements Serial
} catch (Exception ex) { // InstantiationException, IllegalAccessException
throw new RuntimeException(ex); // should never happen
}
dynaBean.set(propertyName, new Double(v));
dynaBean.set(propertyName, Double.valueOf(v));
addObject(dynaBean);
}

View File

@ -60,21 +60,21 @@ public final class BeanListUnivariateImplTest extends TestCase {
patientList = new ArrayList();
// Create and add patient bean 1
VitalStats vs1 = new VitalStats( new Double(120.0),
new Double(96.4) );
Patient p1 = new Patient( vs1, new Integer( 35 ) );
VitalStats vs1 = new VitalStats( Double.valueOf(120.0),
Double.valueOf(96.4) );
Patient p1 = new Patient( vs1, Integer.valueOf( 35 ) );
patientList.add( p1 );
// Create and add patient bean 2
VitalStats vs2 = new VitalStats( new Double(70.0),
new Double(97.4) );
Patient p2 = new Patient( vs2, new Integer( 23 ) );
VitalStats vs2 = new VitalStats( Double.valueOf(70.0),
Double.valueOf(97.4) );
Patient p2 = new Patient( vs2, Integer.valueOf( 23 ) );
patientList.add( p2 );
// Create and add patient bean 3
VitalStats vs3 = new VitalStats( new Double(90.0),
new Double(98.6) );
Patient p3 = new Patient( vs3, new Integer( 42 ) );
VitalStats vs3 = new VitalStats( Double.valueOf(90.0),
Double.valueOf(98.6) );
Patient p3 = new Patient( vs3, Integer.valueOf( 42 ) );
patientList.add( p3 );
}