commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject [math] Avoid explicit instantiation of "Integer" objects for small values.
Date Tue, 10 Nov 2015 22:07:42 GMT
Repository: commons-math
Updated Branches:
  refs/heads/master 396610625 -> 268bcd622


Avoid explicit instantiation of "Integer" objects for small values.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/268bcd62
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/268bcd62
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/268bcd62

Branch: refs/heads/master
Commit: 268bcd622685b28c2d50bcbce64ac38f7e90390b
Parents: 3966106
Author: Gilles <erans@apache.org>
Authored: Tue Nov 10 23:05:27 2015 +0100
Committer: Gilles <erans@apache.org>
Committed: Tue Nov 10 23:05:27 2015 +0100

----------------------------------------------------------------------
 .../math4/distribution/EnumeratedIntegerDistribution.java      | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/268bcd62/src/main/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistribution.java
b/src/main/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistribution.java
index 8cdf8e1..e0843eb 100644
--- a/src/main/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistribution.java
@@ -115,11 +115,9 @@ public class EnumeratedIntegerDistribution extends AbstractIntegerDistribution
{
         for (int value : data) {
             Integer count = dataMap.get(value);
             if (count == null) {
-                count = new Integer(1);
-            } else {
-                count = new Integer(count.intValue() + 1);
+                count = 0;
             }
-            dataMap.put(value, count);
+            dataMap.put(value, ++count);
         }
         final int massPoints = dataMap.size();
         final double denom = data.length;


Mime
View raw message