On Tue, 13 Jul 2021 at 23:41, <er...@apache.org> wrote: > This is an automated email from the ASF dual-hosted git repository. > > erans 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 8f83827 Code simplifications (suggested by "sonarcloud"). > 8f83827 is described below > > commit 8f838278467c1d00ba3e9e83c4f9b963cf246984 > Author: Gilles Sadowski <gillese...@gmail.com> > AuthorDate: Wed Jul 14 00:36:10 2021 +0200 > > Code simplifications (suggested by "sonarcloud"). > --- > .../nonlinear/scalar/noderiv/SimplexOptimizer.java | 31 > +++++----------------- > 1 file changed, 7 insertions(+), 24 deletions(-) > > diff --git > a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java > b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java > index e2fb510..60a2a38 100644 > --- > a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java > +++ > b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java > @@ -123,27 +123,14 @@ public class SimplexOptimizer extends > MultivariateOptimizer { > > // Indirect call to "computeObjectiveValue" in order to update the > // evaluations counter. > - final MultivariateFunction evalFunc > - = new MultivariateFunction() { > - /** {@inheritDoc} */ > - @Override > - public double value(double[] point) { > - return computeObjectiveValue(point); > - } > - }; > + final MultivariateFunction evalFunc = (p) -> > computeObjectiveValue(p); >
Note you will get a checkstyle fail for using parentheses here. Can this be replaced with the method reference: final MultivariateFunction evalFunc = this::computeObjectiveValue; I've not checked the code so you may have to substitute this:: for a class name if it is a static method. Alex