You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by eb...@apache.org on 2021/04/13 08:44:23 UTC
[commons-math] branch master updated: MATH-1571 - Collections
Performance
This is an automated email from the ASF dual-hosted git repository.
ebourg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git
The following commit(s) were added to refs/heads/master by this push:
new e29fd60 MATH-1571 - Collections Performance
e29fd60 is described below
commit e29fd602381be65c0e2c2e4cd1e1c59bfa16c8bd
Author: Arturo Bernal <ar...@gmail.com>
AuthorDate: Tue Apr 13 06:54:59 2021 +0200
MATH-1571 - Collections Performance
---
src/main/java/org/apache/commons/math4/ml/neuralnet/Network.java | 3 +--
.../java/org/apache/commons/math4/optim/linear/SimplexTableau.java | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/Network.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/Network.java
index 040963b..f5dfbd2 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/Network.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/Network.java
@@ -179,8 +179,7 @@ public class Network
* @see NeuronIdentifierComparator
*/
public Collection<Neuron> getNeurons(Comparator<Neuron> comparator) {
- final List<Neuron> neurons = new ArrayList<>();
- neurons.addAll(neuronMap.values());
+ final List<Neuron> neurons = new ArrayList<>(neuronMap.values());
Collections.sort(neurons, comparator);
diff --git a/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java b/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java
index e757679..c306cfc 100644
--- a/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java
+++ b/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java
@@ -603,7 +603,7 @@ class SimplexTableau implements Serializable {
}
// remove the columns in reverse order so the indices are correct
- Integer[] drop = columnsToDrop.toArray(new Integer[columnsToDrop.size()]);
+ Integer[] drop = columnsToDrop.toArray(new Integer[0]);
for (int i = drop.length - 1; i >= 0; i--) {
columnLabels.remove((int) drop[i]);
}