You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2016/09/20 06:40:38 UTC
[08/10] [math] Remove redundant type arguments.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSet.java b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSet.java
index e84bf58..6d4d980 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSet.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSet.java
@@ -59,7 +59,7 @@ public class SphericalPolygonsSet extends AbstractRegion<Sphere2D, Sphere1D> {
* @param tolerance below which points are consider to be identical
*/
public SphericalPolygonsSet(final Vector3D pole, final double tolerance) {
- super(new BSPTree<Sphere2D>(new Circle(pole, tolerance).wholeHyperplane(),
+ super(new BSPTree<>(new Circle(pole, tolerance).wholeHyperplane(),
new BSPTree<Sphere2D>(Boolean.FALSE),
new BSPTree<Sphere2D>(Boolean.TRUE),
null),
@@ -198,7 +198,7 @@ public class SphericalPolygonsSet extends AbstractRegion<Sphere2D, Sphere1D> {
final int n = vertices.length;
if (n == 0) {
// the tree represents the whole space
- return new BSPTree<Sphere2D>(Boolean.TRUE);
+ return new BSPTree<>(Boolean.TRUE);
}
// build the vertices
@@ -208,7 +208,7 @@ public class SphericalPolygonsSet extends AbstractRegion<Sphere2D, Sphere1D> {
}
// build the edges
- List<Edge> edges = new ArrayList<Edge>(n);
+ List<Edge> edges = new ArrayList<>(n);
Vertex end = vArray[n - 1];
for (int i = 0; i < n; ++i) {
@@ -241,7 +241,7 @@ public class SphericalPolygonsSet extends AbstractRegion<Sphere2D, Sphere1D> {
}
// build the tree top-down
- final BSPTree<Sphere2D> tree = new BSPTree<Sphere2D>();
+ final BSPTree<Sphere2D> tree = new BSPTree<>();
insertEdges(hyperplaneThickness, tree, edges);
return tree;
@@ -284,8 +284,8 @@ public class SphericalPolygonsSet extends AbstractRegion<Sphere2D, Sphere1D> {
// we have split the node by inserting an edge as a cut sub-hyperplane
// distribute the remaining edges in the two sub-trees
- final List<Edge> outsideList = new ArrayList<Edge>();
- final List<Edge> insideList = new ArrayList<Edge>();
+ final List<Edge> outsideList = new ArrayList<>();
+ final List<Edge> insideList = new ArrayList<>();
for (final Edge edge : edges) {
if (edge != inserted) {
edge.split(inserted.getCircle(), outsideList, insideList);
@@ -384,7 +384,7 @@ public class SphericalPolygonsSet extends AbstractRegion<Sphere2D, Sphere1D> {
// convert the list of all edges into a list of start vertices
- loops = new ArrayList<Vertex>();
+ loops = new ArrayList<>();
while (!edges.isEmpty()) {
// this is an edge belonging to a new loop, store it
@@ -468,10 +468,10 @@ public class SphericalPolygonsSet extends AbstractRegion<Sphere2D, Sphere1D> {
// handle special cases first
if (isEmpty()) {
- return new EnclosingBall<Sphere2D, S2Point>(S2Point.PLUS_K, Double.NEGATIVE_INFINITY);
+ return new EnclosingBall<>(S2Point.PLUS_K, Double.NEGATIVE_INFINITY);
}
if (isFull()) {
- return new EnclosingBall<Sphere2D, S2Point>(S2Point.PLUS_K, Double.POSITIVE_INFINITY);
+ return new EnclosingBall<>(S2Point.PLUS_K, Double.POSITIVE_INFINITY);
}
// as the polygons is neither empty nor full, it has some boundaries and cut hyperplanes
@@ -479,13 +479,13 @@ public class SphericalPolygonsSet extends AbstractRegion<Sphere2D, Sphere1D> {
if (isEmpty(root.getMinus()) && isFull(root.getPlus())) {
// the polygon covers an hemisphere, and its boundary is one 2\u03c0 long edge
final Circle circle = (Circle) root.getCut().getHyperplane();
- return new EnclosingBall<Sphere2D, S2Point>(new S2Point(circle.getPole()).negate(),
+ return new EnclosingBall<>(new S2Point(circle.getPole()).negate(),
0.5 * FastMath.PI);
}
if (isFull(root.getMinus()) && isEmpty(root.getPlus())) {
// the polygon covers an hemisphere, and its boundary is one 2\u03c0 long edge
final Circle circle = (Circle) root.getCut().getHyperplane();
- return new EnclosingBall<Sphere2D, S2Point>(new S2Point(circle.getPole()),
+ return new EnclosingBall<>(new S2Point(circle.getPole()),
0.5 * FastMath.PI);
}
@@ -505,7 +505,7 @@ public class SphericalPolygonsSet extends AbstractRegion<Sphere2D, Sphere1D> {
// find the smallest enclosing 3D sphere
final SphereGenerator generator = new SphereGenerator();
final WelzlEncloser<Euclidean3D, Vector3D> encloser =
- new WelzlEncloser<Euclidean3D, Vector3D>(getTolerance(), generator);
+ new WelzlEncloser<>(getTolerance(), generator);
EnclosingBall<Euclidean3D, Vector3D> enclosing3D = encloser.enclose(points);
final Vector3D[] support3D = enclosing3D.getSupport();
@@ -516,12 +516,12 @@ public class SphericalPolygonsSet extends AbstractRegion<Sphere2D, Sphere1D> {
// the 3D sphere is centered on the unit sphere and covers it
// fall back to a crude approximation, based only on outside convex cells
EnclosingBall<Sphere2D, S2Point> enclosingS2 =
- new EnclosingBall<Sphere2D, S2Point>(S2Point.PLUS_K, Double.POSITIVE_INFINITY);
+ new EnclosingBall<>(S2Point.PLUS_K, Double.POSITIVE_INFINITY);
for (Vector3D outsidePoint : getOutsidePoints()) {
final S2Point outsideS2 = new S2Point(outsidePoint);
final BoundaryProjection<Sphere2D> projection = projectToBoundary(outsideS2);
if (FastMath.PI - projection.getOffset() < enclosingS2.getRadius()) {
- enclosingS2 = new EnclosingBall<Sphere2D, S2Point>(outsideS2.negate(),
+ enclosingS2 = new EnclosingBall<>(outsideS2.negate(),
FastMath.PI - projection.getOffset(),
(S2Point) projection.getProjected());
}
@@ -534,7 +534,7 @@ public class SphericalPolygonsSet extends AbstractRegion<Sphere2D, Sphere1D> {
}
final EnclosingBall<Sphere2D, S2Point> enclosingS2 =
- new EnclosingBall<Sphere2D, S2Point>(new S2Point(enclosing3D.getCenter()),
+ new EnclosingBall<>(new S2Point(enclosing3D.getCenter()),
FastMath.acos((1 + h * h - r * r) / (2 * h)),
support);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SubCircle.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SubCircle.java b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SubCircle.java
index 837c953..ba74b52 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SubCircle.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SubCircle.java
@@ -56,14 +56,14 @@ public class SubCircle extends AbstractSubHyperplane<Sphere2D, Sphere1D> {
if (angle < thisCircle.getTolerance() || angle > FastMath.PI - thisCircle.getTolerance()) {
// the two circles are aligned or opposite
- return new SplitSubHyperplane<Sphere2D>(null, null);
+ return new SplitSubHyperplane<>(null, null);
} else {
// the two circles intersect each other
final Arc arc = thisCircle.getInsideArc(otherCircle);
final ArcsSet.Split split = ((ArcsSet) getRemainingRegion()).split(arc);
final ArcsSet plus = split.getPlus();
final ArcsSet minus = split.getMinus();
- return new SplitSubHyperplane<Sphere2D>(plus == null ? null : new SubCircle(thisCircle.copySelf(), plus),
+ return new SplitSubHyperplane<>(plus == null ? null : new SubCircle(thisCircle.copySelf(), plus),
minus == null ? null : new SubCircle(thisCircle.copySelf(), minus));
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Vertex.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Vertex.java b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Vertex.java
index d3102c1..a8b1db2 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Vertex.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Vertex.java
@@ -45,7 +45,7 @@ public class Vertex {
this.location = location;
this.incoming = null;
this.outgoing = null;
- this.circles = new ArrayList<Circle>();
+ this.circles = new ArrayList<>();
}
/** Get Vertex location.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java b/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java
index 23c4969..a182e49 100644
--- a/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java
@@ -270,7 +270,7 @@ public abstract class AbstractFieldMatrix<T extends FieldElement<T>>
final char[] binaryRepresentation = Integer.toBinaryString(power)
.toCharArray();
- final ArrayList<Integer> nonZeroPositions = new ArrayList<Integer>();
+ final ArrayList<Integer> nonZeroPositions = new ArrayList<>();
for (int i = 0; i < binaryRepresentation.length; ++i) {
if (binaryRepresentation[i] == '1') {
@@ -279,7 +279,7 @@ public abstract class AbstractFieldMatrix<T extends FieldElement<T>>
}
}
- ArrayList<FieldMatrix<T>> results = new ArrayList<FieldMatrix<T>>(
+ ArrayList<FieldMatrix<T>> results = new ArrayList<>(
binaryRepresentation.length);
results.add(0, this.copy());
@@ -537,7 +537,7 @@ public abstract class AbstractFieldMatrix<T extends FieldElement<T>>
@Override
public FieldVector<T> getRowVector(final int row)
throws OutOfRangeException {
- return new ArrayFieldVector<T>(field, getRow(row), false);
+ return new ArrayFieldVector<>(field, getRow(row), false);
}
/** {@inheritDoc} */
@@ -560,7 +560,7 @@ public abstract class AbstractFieldMatrix<T extends FieldElement<T>>
@Override
public FieldVector<T> getColumnVector(final int column)
throws OutOfRangeException {
- return new ArrayFieldVector<T>(field, getColumn(column), false);
+ return new ArrayFieldVector<>(field, getColumn(column), false);
}
/** {@inheritDoc} */
@@ -726,7 +726,7 @@ public abstract class AbstractFieldMatrix<T extends FieldElement<T>>
public FieldVector<T> operate(final FieldVector<T> v)
throws DimensionMismatchException {
try {
- return new ArrayFieldVector<T>(field, operate(((ArrayFieldVector<T>) v).getDataRef()), false);
+ return new ArrayFieldVector<>(field, operate(((ArrayFieldVector<T>) v).getDataRef()), false);
} catch (ClassCastException cce) {
final int nRows = getRowDimension();
final int nCols = getColumnDimension();
@@ -743,7 +743,7 @@ public abstract class AbstractFieldMatrix<T extends FieldElement<T>>
out[row] = sum;
}
- return new ArrayFieldVector<T>(field, out, false);
+ return new ArrayFieldVector<>(field, out, false);
}
}
@@ -774,7 +774,7 @@ public abstract class AbstractFieldMatrix<T extends FieldElement<T>>
public FieldVector<T> preMultiply(final FieldVector<T> v)
throws DimensionMismatchException {
try {
- return new ArrayFieldVector<T>(field, preMultiply(((ArrayFieldVector<T>) v).getDataRef()), false);
+ return new ArrayFieldVector<>(field, preMultiply(((ArrayFieldVector<T>) v).getDataRef()), false);
} catch (ClassCastException cce) {
final int nRows = getRowDimension();
final int nCols = getColumnDimension();
@@ -791,7 +791,7 @@ public abstract class AbstractFieldMatrix<T extends FieldElement<T>>
out[col] = sum;
}
- return new ArrayFieldVector<T>(field, out, false);
+ return new ArrayFieldVector<>(field, out, false);
}
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java b/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java
index 4dcf640..76ef1cb 100644
--- a/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java
@@ -198,7 +198,7 @@ public abstract class AbstractRealMatrix
*/
final char[] binaryRepresentation = Integer.toBinaryString(power).toCharArray();
- final ArrayList<Integer> nonZeroPositions = new ArrayList<Integer>();
+ final ArrayList<Integer> nonZeroPositions = new ArrayList<>();
int maxI = -1;
for (int i = 0; i < binaryRepresentation.length; ++i) {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/linear/Array2DRowFieldMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/Array2DRowFieldMatrix.java b/src/main/java/org/apache/commons/math4/linear/Array2DRowFieldMatrix.java
index 70d7894..7a70931 100644
--- a/src/main/java/org/apache/commons/math4/linear/Array2DRowFieldMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/Array2DRowFieldMatrix.java
@@ -208,13 +208,13 @@ public class Array2DRowFieldMatrix<T extends FieldElement<T>>
public FieldMatrix<T> createMatrix(final int rowDimension,
final int columnDimension)
throws NotStrictlyPositiveException {
- return new Array2DRowFieldMatrix<T>(getField(), rowDimension, columnDimension);
+ return new Array2DRowFieldMatrix<>(getField(), rowDimension, columnDimension);
}
/** {@inheritDoc} */
@Override
public FieldMatrix<T> copy() {
- return new Array2DRowFieldMatrix<T>(getField(), copyOut(), false);
+ return new Array2DRowFieldMatrix<>(getField(), copyOut(), false);
}
/**
@@ -242,7 +242,7 @@ public class Array2DRowFieldMatrix<T extends FieldElement<T>>
}
}
- return new Array2DRowFieldMatrix<T>(getField(), outData, false);
+ return new Array2DRowFieldMatrix<>(getField(), outData, false);
}
/**
@@ -270,7 +270,7 @@ public class Array2DRowFieldMatrix<T extends FieldElement<T>>
}
}
- return new Array2DRowFieldMatrix<T>(getField(), outData, false);
+ return new Array2DRowFieldMatrix<>(getField(), outData, false);
}
@@ -303,7 +303,7 @@ public class Array2DRowFieldMatrix<T extends FieldElement<T>>
}
}
- return new Array2DRowFieldMatrix<T>(getField(), outData, false);
+ return new Array2DRowFieldMatrix<>(getField(), outData, false);
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/linear/ArrayFieldVector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/ArrayFieldVector.java b/src/main/java/org/apache/commons/math4/linear/ArrayFieldVector.java
index b2240e6..b468bb7 100644
--- a/src/main/java/org/apache/commons/math4/linear/ArrayFieldVector.java
+++ b/src/main/java/org/apache/commons/math4/linear/ArrayFieldVector.java
@@ -388,7 +388,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
/** {@inheritDoc} */
@Override
public FieldVector<T> copy() {
- return new ArrayFieldVector<T>(this, true);
+ return new ArrayFieldVector<>(this, true);
}
/** {@inheritDoc} */
@@ -403,7 +403,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
for (int i = 0; i < data.length; i++) {
out[i] = data[i].add(v.getEntry(i));
}
- return new ArrayFieldVector<T>(field, out, false);
+ return new ArrayFieldVector<>(field, out, false);
}
}
@@ -421,7 +421,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
for (int i = 0; i < data.length; i++) {
out[i] = data[i].add(v.data[i]);
}
- return new ArrayFieldVector<T>(field, out, false);
+ return new ArrayFieldVector<>(field, out, false);
}
/** {@inheritDoc} */
@@ -436,7 +436,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
for (int i = 0; i < data.length; i++) {
out[i] = data[i].subtract(v.getEntry(i));
}
- return new ArrayFieldVector<T>(field, out, false);
+ return new ArrayFieldVector<>(field, out, false);
}
}
@@ -454,7 +454,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
for (int i = 0; i < data.length; i++) {
out[i] = data[i].subtract(v.data[i]);
}
- return new ArrayFieldVector<T>(field, out, false);
+ return new ArrayFieldVector<>(field, out, false);
}
/** {@inheritDoc} */
@@ -464,7 +464,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
for (int i = 0; i < data.length; i++) {
out[i] = data[i].add(d);
}
- return new ArrayFieldVector<T>(field, out, false);
+ return new ArrayFieldVector<>(field, out, false);
}
/** {@inheritDoc} */
@@ -483,7 +483,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
for (int i = 0; i < data.length; i++) {
out[i] = data[i].subtract(d);
}
- return new ArrayFieldVector<T>(field, out, false);
+ return new ArrayFieldVector<>(field, out, false);
}
/** {@inheritDoc} */
@@ -502,7 +502,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
for (int i = 0; i < data.length; i++) {
out[i] = data[i].multiply(d);
}
- return new ArrayFieldVector<T>(field, out, false);
+ return new ArrayFieldVector<>(field, out, false);
}
/** {@inheritDoc} */
@@ -523,7 +523,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
for (int i = 0; i < data.length; i++) {
out[i] = data[i].divide(d);
}
- return new ArrayFieldVector<T>(field, out, false);
+ return new ArrayFieldVector<>(field, out, false);
}
/** {@inheritDoc} */
@@ -549,7 +549,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
throw new MathArithmeticException(LocalizedFormats.INDEX, i);
}
}
- return new ArrayFieldVector<T>(field, out, false);
+ return new ArrayFieldVector<>(field, out, false);
}
/** {@inheritDoc} */
@@ -578,7 +578,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
for (int i = 0; i < data.length; i++) {
out[i] = data[i].multiply(v.getEntry(i));
}
- return new ArrayFieldVector<T>(field, out, false);
+ return new ArrayFieldVector<>(field, out, false);
}
}
@@ -596,7 +596,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
for (int i = 0; i < data.length; i++) {
out[i] = data[i].multiply(v.data[i]);
}
- return new ArrayFieldVector<T>(field, out, false);
+ return new ArrayFieldVector<>(field, out, false);
}
/** {@inheritDoc} */
@@ -615,7 +615,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
throw new MathArithmeticException(LocalizedFormats.INDEX, i);
}
}
- return new ArrayFieldVector<T>(field, out, false);
+ return new ArrayFieldVector<>(field, out, false);
}
}
@@ -638,7 +638,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
throw new MathArithmeticException(LocalizedFormats.INDEX, i);
}
}
- return new ArrayFieldVector<T>(field, out, false);
+ return new ArrayFieldVector<>(field, out, false);
}
/**
@@ -710,7 +710,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
} catch (ClassCastException cce) {
final int m = data.length;
final int n = v.getDimension();
- final FieldMatrix<T> out = new Array2DRowFieldMatrix<T>(field, m, n);
+ final FieldMatrix<T> out = new Array2DRowFieldMatrix<>(field, m, n);
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
out.setEntry(i, j, data[i].multiply(v.getEntry(j)));
@@ -728,7 +728,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
public FieldMatrix<T> outerProduct(ArrayFieldVector<T> v) {
final int m = data.length;
final int n = v.data.length;
- final FieldMatrix<T> out = new Array2DRowFieldMatrix<T>(field, m, n);
+ final FieldMatrix<T> out = new Array2DRowFieldMatrix<>(field, m, n);
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
out.setEntry(i, j, data[i].multiply(v.data[j]));
@@ -755,7 +755,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
try {
return append((ArrayFieldVector<T>) v);
} catch (ClassCastException cce) {
- return new ArrayFieldVector<T>(this,new ArrayFieldVector<T>(v));
+ return new ArrayFieldVector<>(this,new ArrayFieldVector<>(v));
}
}
@@ -765,7 +765,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
* @return a new vector
*/
public ArrayFieldVector<T> append(ArrayFieldVector<T> v) {
- return new ArrayFieldVector<T>(this, v);
+ return new ArrayFieldVector<>(this, v);
}
/** {@inheritDoc} */
@@ -774,7 +774,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
final T[] out = MathArrays.buildArray(field, data.length + 1);
System.arraycopy(data, 0, out, 0, data.length);
out[data.length] = in;
- return new ArrayFieldVector<T>(field, out, false);
+ return new ArrayFieldVector<>(field, out, false);
}
/** {@inheritDoc} */
@@ -784,7 +784,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
if (n < 0) {
throw new NotPositiveException(LocalizedFormats.NUMBER_OF_ELEMENTS_SHOULD_BE_POSITIVE, n);
}
- ArrayFieldVector<T> out = new ArrayFieldVector<T>(field, n);
+ ArrayFieldVector<T> out = new ArrayFieldVector<>(field, n);
try {
System.arraycopy(data, index, out.data, 0, n);
} catch (IndexOutOfBoundsException e) {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/linear/BlockFieldMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/BlockFieldMatrix.java b/src/main/java/org/apache/commons/math4/linear/BlockFieldMatrix.java
index e5294f2..74c6fe8 100644
--- a/src/main/java/org/apache/commons/math4/linear/BlockFieldMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/BlockFieldMatrix.java
@@ -294,7 +294,7 @@ public class BlockFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMa
public FieldMatrix<T> createMatrix(final int rowDimension,
final int columnDimension)
throws NotStrictlyPositiveException {
- return new BlockFieldMatrix<T>(getField(), rowDimension,
+ return new BlockFieldMatrix<>(getField(), rowDimension,
columnDimension);
}
@@ -303,7 +303,7 @@ public class BlockFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMa
public FieldMatrix<T> copy() {
// create an empty matrix
- BlockFieldMatrix<T> copied = new BlockFieldMatrix<T>(getField(), rows, columns);
+ BlockFieldMatrix<T> copied = new BlockFieldMatrix<>(getField(), rows, columns);
// copy the blocks
for (int i = 0; i < blocks.length; ++i) {
@@ -324,7 +324,7 @@ public class BlockFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMa
// safety check
checkAdditionCompatible(m);
- final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
+ final BlockFieldMatrix<T> out = new BlockFieldMatrix<>(getField(), rows, columns);
// perform addition block-wise, to ensure good cache behavior
int blockIndex = 0;
@@ -370,7 +370,7 @@ public class BlockFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMa
// safety check
checkAdditionCompatible(m);
- final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
+ final BlockFieldMatrix<T> out = new BlockFieldMatrix<>(getField(), rows, columns);
// perform addition block-wise, to ensure good cache behavior
for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
@@ -396,7 +396,7 @@ public class BlockFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMa
// safety check
checkSubtractionCompatible(m);
- final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
+ final BlockFieldMatrix<T> out = new BlockFieldMatrix<>(getField(), rows, columns);
// perform subtraction block-wise, to ensure good cache behavior
int blockIndex = 0;
@@ -440,7 +440,7 @@ public class BlockFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMa
// safety check
checkSubtractionCompatible(m);
- final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
+ final BlockFieldMatrix<T> out = new BlockFieldMatrix<>(getField(), rows, columns);
// perform subtraction block-wise, to ensure good cache behavior
for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
@@ -458,7 +458,7 @@ public class BlockFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMa
/** {@inheritDoc} */
@Override
public FieldMatrix<T> scalarAdd(final T d) {
- final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
+ final BlockFieldMatrix<T> out = new BlockFieldMatrix<>(getField(), rows, columns);
// perform subtraction block-wise, to ensure good cache behavior
for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
@@ -476,7 +476,7 @@ public class BlockFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMa
@Override
public FieldMatrix<T> scalarMultiply(final T d) {
- final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
+ final BlockFieldMatrix<T> out = new BlockFieldMatrix<>(getField(), rows, columns);
// perform subtraction block-wise, to ensure good cache behavior
for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
@@ -501,7 +501,7 @@ public class BlockFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMa
// safety check
checkMultiplicationCompatible(m);
- final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, m.getColumnDimension());
+ final BlockFieldMatrix<T> out = new BlockFieldMatrix<>(getField(), rows, m.getColumnDimension());
final T zero = getField().getZero();
// perform multiplication block-wise, to ensure good cache behavior
@@ -564,7 +564,7 @@ public class BlockFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMa
// safety check
checkMultiplicationCompatible(m);
- final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, m.columns);
+ final BlockFieldMatrix<T> out = new BlockFieldMatrix<>(getField(), rows, m.columns);
final T zero = getField().getZero();
// perform multiplication block-wise, to ensure good cache behavior
@@ -663,7 +663,7 @@ public class BlockFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMa
// create the output matrix
final BlockFieldMatrix<T> out =
- new BlockFieldMatrix<T>(getField(), endRow - startRow + 1, endColumn - startColumn + 1);
+ new BlockFieldMatrix<>(getField(), endRow - startRow + 1, endColumn - startColumn + 1);
// compute blocks shifts
final int blockStartRow = startRow / BLOCK_SIZE;
@@ -836,7 +836,7 @@ public class BlockFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMa
public FieldMatrix<T> getRowMatrix(final int row)
throws OutOfRangeException {
checkRowIndex(row);
- final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), 1, columns);
+ final BlockFieldMatrix<T> out = new BlockFieldMatrix<>(getField(), 1, columns);
// perform copy block-wise, to ensure good cache behavior
final int iBlock = row / BLOCK_SIZE;
@@ -922,7 +922,7 @@ public class BlockFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMa
public FieldMatrix<T> getColumnMatrix(final int column)
throws OutOfRangeException {
checkColumnIndex(column);
- final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, 1);
+ final BlockFieldMatrix<T> out = new BlockFieldMatrix<>(getField(), rows, 1);
// perform copy block-wise, to ensure good cache behavior
final int jBlock = column / BLOCK_SIZE;
@@ -1017,7 +1017,7 @@ public class BlockFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMa
outIndex += jWidth;
}
- return new ArrayFieldVector<T>(getField(), outData, false);
+ return new ArrayFieldVector<>(getField(), outData, false);
}
/** {@inheritDoc} */
@@ -1051,7 +1051,7 @@ public class BlockFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMa
}
}
- return new ArrayFieldVector<T>(getField(), outData, false);
+ return new ArrayFieldVector<>(getField(), outData, false);
}
/** {@inheritDoc} */
@@ -1220,7 +1220,7 @@ public class BlockFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMa
public FieldMatrix<T> transpose() {
final int nRows = getRowDimension();
final int nCols = getColumnDimension();
- final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), nCols, nRows);
+ final BlockFieldMatrix<T> out = new BlockFieldMatrix<>(getField(), nCols, nRows);
// perform transpose block-wise, to ensure good cache behavior
int blockIndex = 0;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/linear/FieldLUDecomposition.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/FieldLUDecomposition.java b/src/main/java/org/apache/commons/math4/linear/FieldLUDecomposition.java
index 1e4c473..e733f42 100644
--- a/src/main/java/org/apache/commons/math4/linear/FieldLUDecomposition.java
+++ b/src/main/java/org/apache/commons/math4/linear/FieldLUDecomposition.java
@@ -171,7 +171,7 @@ public class FieldLUDecomposition<T extends FieldElement<T>> {
public FieldMatrix<T> getL() {
if ((cachedL == null) && !singular) {
final int m = pivot.length;
- cachedL = new Array2DRowFieldMatrix<T>(field, m, m);
+ cachedL = new Array2DRowFieldMatrix<>(field, m, m);
for (int i = 0; i < m; ++i) {
final T[] luI = lu[i];
for (int j = 0; j < i; ++j) {
@@ -191,7 +191,7 @@ public class FieldLUDecomposition<T extends FieldElement<T>> {
public FieldMatrix<T> getU() {
if ((cachedU == null) && !singular) {
final int m = pivot.length;
- cachedU = new Array2DRowFieldMatrix<T>(field, m, m);
+ cachedU = new Array2DRowFieldMatrix<>(field, m, m);
for (int i = 0; i < m; ++i) {
final T[] luI = lu[i];
for (int j = i; j < m; ++j) {
@@ -214,7 +214,7 @@ public class FieldLUDecomposition<T extends FieldElement<T>> {
public FieldMatrix<T> getP() {
if ((cachedP == null) && !singular) {
final int m = pivot.length;
- cachedP = new Array2DRowFieldMatrix<T>(field, m, m);
+ cachedP = new Array2DRowFieldMatrix<>(field, m, m);
for (int i = 0; i < m; ++i) {
cachedP.setEntry(i, pivot[i], field.getOne());
}
@@ -253,7 +253,7 @@ public class FieldLUDecomposition<T extends FieldElement<T>> {
* @return a solver
*/
public FieldDecompositionSolver<T> getSolver() {
- return new Solver<T>(field, lu, pivot, singular);
+ return new Solver<>(field, lu, pivot, singular);
}
/** Specialized solver.
@@ -332,7 +332,7 @@ public class FieldLUDecomposition<T extends FieldElement<T>> {
}
}
- return new ArrayFieldVector<T>(field, bp, false);
+ return new ArrayFieldVector<>(field, bp, false);
}
}
@@ -377,7 +377,7 @@ public class FieldLUDecomposition<T extends FieldElement<T>> {
}
}
- return new ArrayFieldVector<T>(bp, false);
+ return new ArrayFieldVector<>(bp, false);
}
/** {@inheritDoc} */
@@ -431,7 +431,7 @@ public class FieldLUDecomposition<T extends FieldElement<T>> {
}
}
- return new Array2DRowFieldMatrix<T>(field, bp, false);
+ return new Array2DRowFieldMatrix<>(field, bp, false);
}
@@ -440,7 +440,7 @@ public class FieldLUDecomposition<T extends FieldElement<T>> {
public FieldMatrix<T> getInverse() {
final int m = pivot.length;
final T one = field.getOne();
- FieldMatrix<T> identity = new Array2DRowFieldMatrix<T>(field, m, m);
+ FieldMatrix<T> identity = new Array2DRowFieldMatrix<>(field, m, m);
for (int i = 0; i < m; ++i) {
identity.setEntry(i, i, one);
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/linear/MatrixUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/MatrixUtils.java b/src/main/java/org/apache/commons/math4/linear/MatrixUtils.java
index 19ff724..a18c015 100644
--- a/src/main/java/org/apache/commons/math4/linear/MatrixUtils.java
+++ b/src/main/java/org/apache/commons/math4/linear/MatrixUtils.java
@@ -101,7 +101,7 @@ public class MatrixUtils {
final int rows,
final int columns) {
return (rows * columns <= 4096) ?
- new Array2DRowFieldMatrix<T>(field, rows, columns) : new BlockFieldMatrix<T>(field, rows, columns);
+ new Array2DRowFieldMatrix<>(field, rows, columns) : new BlockFieldMatrix<>(field, rows, columns);
}
/**
@@ -161,7 +161,7 @@ public class MatrixUtils {
throw new NullArgumentException();
}
return (data.length * data[0].length <= 4096) ?
- new Array2DRowFieldMatrix<T>(data) : new BlockFieldMatrix<T>(data);
+ new Array2DRowFieldMatrix<>(data) : new BlockFieldMatrix<>(data);
}
/**
@@ -200,7 +200,7 @@ public class MatrixUtils {
Arrays.fill(dRow, zero);
dRow[row] = one;
}
- return new Array2DRowFieldMatrix<T>(field, d, false);
+ return new Array2DRowFieldMatrix<>(field, d, false);
}
/**
@@ -272,7 +272,7 @@ public class MatrixUtils {
if (data.length == 0) {
throw new ZeroException(LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT);
}
- return new ArrayFieldVector<T>(data[0].getField(), data, true);
+ return new ArrayFieldVector<>(data[0].getField(), data, true);
}
/**
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/linear/RealMatrixFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/RealMatrixFormat.java b/src/main/java/org/apache/commons/math4/linear/RealMatrixFormat.java
index 8601490..34c0b0e 100644
--- a/src/main/java/org/apache/commons/math4/linear/RealMatrixFormat.java
+++ b/src/main/java/org/apache/commons/math4/linear/RealMatrixFormat.java
@@ -315,8 +315,8 @@ public class RealMatrixFormat {
}
// parse components
- List<List<Number>> matrix = new ArrayList<List<Number>>();
- List<Number> rowComponents = new ArrayList<Number>();
+ List<List<Number>> matrix = new ArrayList<>();
+ List<Number> rowComponents = new ArrayList<>();
for (boolean loop = true; loop;){
if (!rowComponents.isEmpty()) {
@@ -329,7 +329,7 @@ public class RealMatrixFormat {
CompositeFormat.parseAndIgnoreWhitespace(source, pos);
if (CompositeFormat.parseFixedstring(source, trimmedRowSeparator, pos)) {
matrix.add(rowComponents);
- rowComponents = new ArrayList<Number>();
+ rowComponents = new ArrayList<>();
continue;
} else {
loop = false;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/linear/RealVectorFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/RealVectorFormat.java b/src/main/java/org/apache/commons/math4/linear/RealVectorFormat.java
index 49de55d..2ffb378 100644
--- a/src/main/java/org/apache/commons/math4/linear/RealVectorFormat.java
+++ b/src/main/java/org/apache/commons/math4/linear/RealVectorFormat.java
@@ -247,7 +247,7 @@ public class RealVectorFormat {
}
// parse components
- List<Number> components = new ArrayList<Number>();
+ List<Number> components = new ArrayList<>();
for (boolean loop = true; loop;){
if (!components.isEmpty()) {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/linear/SparseFieldMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/SparseFieldMatrix.java b/src/main/java/org/apache/commons/math4/linear/SparseFieldMatrix.java
index b48970c..70d5999 100644
--- a/src/main/java/org/apache/commons/math4/linear/SparseFieldMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/SparseFieldMatrix.java
@@ -51,7 +51,7 @@ public class SparseFieldMatrix<T extends FieldElement<T>> extends AbstractFieldM
super(field);
rows = 0;
columns= 0;
- entries = new OpenIntToFieldHashMap<T>(field);
+ entries = new OpenIntToFieldHashMap<>(field);
}
/**
@@ -69,7 +69,7 @@ public class SparseFieldMatrix<T extends FieldElement<T>> extends AbstractFieldM
super(field, rowDimension, columnDimension);
this.rows = rowDimension;
this.columns = columnDimension;
- entries = new OpenIntToFieldHashMap<T>(field);
+ entries = new OpenIntToFieldHashMap<>(field);
}
/**
@@ -81,7 +81,7 @@ public class SparseFieldMatrix<T extends FieldElement<T>> extends AbstractFieldM
super(other.getField(), other.getRowDimension(), other.getColumnDimension());
rows = other.getRowDimension();
columns = other.getColumnDimension();
- entries = new OpenIntToFieldHashMap<T>(other.entries);
+ entries = new OpenIntToFieldHashMap<>(other.entries);
}
/**
@@ -93,7 +93,7 @@ public class SparseFieldMatrix<T extends FieldElement<T>> extends AbstractFieldM
super(other.getField(), other.getRowDimension(), other.getColumnDimension());
rows = other.getRowDimension();
columns = other.getColumnDimension();
- entries = new OpenIntToFieldHashMap<T>(getField());
+ entries = new OpenIntToFieldHashMap<>(getField());
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
setEntry(i, j, other.getEntry(i, j));
@@ -118,13 +118,13 @@ public class SparseFieldMatrix<T extends FieldElement<T>> extends AbstractFieldM
/** {@inheritDoc} */
@Override
public FieldMatrix<T> copy() {
- return new SparseFieldMatrix<T>(this);
+ return new SparseFieldMatrix<>(this);
}
/** {@inheritDoc} */
@Override
public FieldMatrix<T> createMatrix(int rowDimension, int columnDimension) {
- return new SparseFieldMatrix<T>(getField(), rowDimension, columnDimension);
+ return new SparseFieldMatrix<>(getField(), rowDimension, columnDimension);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/linear/SparseFieldVector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/SparseFieldVector.java b/src/main/java/org/apache/commons/math4/linear/SparseFieldVector.java
index 7065f10..1bf041d 100644
--- a/src/main/java/org/apache/commons/math4/linear/SparseFieldVector.java
+++ b/src/main/java/org/apache/commons/math4/linear/SparseFieldVector.java
@@ -77,7 +77,7 @@ public class SparseFieldVector<T extends FieldElement<T>> implements FieldVector
public SparseFieldVector(Field<T> field, int dimension) {
this.field = field;
virtualSize = dimension;
- entries = new OpenIntToFieldHashMap<T>(field);
+ entries = new OpenIntToFieldHashMap<>(field);
}
/**
@@ -89,7 +89,7 @@ public class SparseFieldVector<T extends FieldElement<T>> implements FieldVector
protected SparseFieldVector(SparseFieldVector<T> v, int resize) {
field = v.field;
virtualSize = v.getDimension() + resize;
- entries = new OpenIntToFieldHashMap<T>(v.entries);
+ entries = new OpenIntToFieldHashMap<>(v.entries);
}
@@ -103,7 +103,7 @@ public class SparseFieldVector<T extends FieldElement<T>> implements FieldVector
public SparseFieldVector(Field<T> field, int dimension, int expectedSize) {
this.field = field;
virtualSize = dimension;
- entries = new OpenIntToFieldHashMap<T>(field,expectedSize);
+ entries = new OpenIntToFieldHashMap<>(field,expectedSize);
}
/**
@@ -118,7 +118,7 @@ public class SparseFieldVector<T extends FieldElement<T>> implements FieldVector
MathUtils.checkNotNull(values);
this.field = field;
virtualSize = values.length;
- entries = new OpenIntToFieldHashMap<T>(field);
+ entries = new OpenIntToFieldHashMap<>(field);
for (int key = 0; key < values.length; key++) {
T value = values[key];
entries.put(key, value);
@@ -133,7 +133,7 @@ public class SparseFieldVector<T extends FieldElement<T>> implements FieldVector
public SparseFieldVector(SparseFieldVector<T> v) {
field = v.field;
virtualSize = v.getDimension();
- entries = new OpenIntToFieldHashMap<T>(v.getEntries());
+ entries = new OpenIntToFieldHashMap<>(v.getEntries());
}
/**
@@ -179,7 +179,7 @@ public class SparseFieldVector<T extends FieldElement<T>> implements FieldVector
* @return a new vector.
*/
public FieldVector<T> append(SparseFieldVector<T> v) {
- SparseFieldVector<T> res = new SparseFieldVector<T>(this, v.getDimension());
+ SparseFieldVector<T> res = new SparseFieldVector<>(this, v.getDimension());
OpenIntToFieldHashMap<T>.Iterator iter = v.entries.iterator();
while (iter.hasNext()) {
iter.advance();
@@ -195,7 +195,7 @@ public class SparseFieldVector<T extends FieldElement<T>> implements FieldVector
return append((SparseFieldVector<T>) v);
} else {
final int n = v.getDimension();
- FieldVector<T> res = new SparseFieldVector<T>(this, n);
+ FieldVector<T> res = new SparseFieldVector<>(this, n);
for (int i = 0; i < n; i++) {
res.setEntry(i + virtualSize, v.getEntry(i));
}
@@ -209,7 +209,7 @@ public class SparseFieldVector<T extends FieldElement<T>> implements FieldVector
@Override
public FieldVector<T> append(T d) throws NullArgumentException {
MathUtils.checkNotNull(d);
- FieldVector<T> res = new SparseFieldVector<T>(this, 1);
+ FieldVector<T> res = new SparseFieldVector<>(this, 1);
res.setEntry(virtualSize, d);
return res;
}
@@ -217,7 +217,7 @@ public class SparseFieldVector<T extends FieldElement<T>> implements FieldVector
/** {@inheritDoc} */
@Override
public FieldVector<T> copy() {
- return new SparseFieldVector<T>(this);
+ return new SparseFieldVector<>(this);
}
/** {@inheritDoc} */
@@ -238,7 +238,7 @@ public class SparseFieldVector<T extends FieldElement<T>> implements FieldVector
public FieldVector<T> ebeDivide(FieldVector<T> v)
throws DimensionMismatchException, MathArithmeticException {
checkVectorDimensions(v.getDimension());
- SparseFieldVector<T> res = new SparseFieldVector<T>(this);
+ SparseFieldVector<T> res = new SparseFieldVector<>(this);
OpenIntToFieldHashMap<T>.Iterator iter = res.entries.iterator();
while (iter.hasNext()) {
iter.advance();
@@ -252,7 +252,7 @@ public class SparseFieldVector<T extends FieldElement<T>> implements FieldVector
public FieldVector<T> ebeMultiply(FieldVector<T> v)
throws DimensionMismatchException {
checkVectorDimensions(v.getDimension());
- SparseFieldVector<T> res = new SparseFieldVector<T>(this);
+ SparseFieldVector<T> res = new SparseFieldVector<>(this);
OpenIntToFieldHashMap<T>.Iterator iter = res.entries.iterator();
while (iter.hasNext()) {
iter.advance();
@@ -289,7 +289,7 @@ public class SparseFieldVector<T extends FieldElement<T>> implements FieldVector
}
checkIndex(index);
checkIndex(index + n - 1);
- SparseFieldVector<T> res = new SparseFieldVector<T>(field,n);
+ SparseFieldVector<T> res = new SparseFieldVector<>(field,n);
int end = index + n;
OpenIntToFieldHashMap<T>.Iterator iter = entries.iterator();
while (iter.hasNext()) {
@@ -387,7 +387,7 @@ public class SparseFieldVector<T extends FieldElement<T>> implements FieldVector
*/
public FieldMatrix<T> outerProduct(SparseFieldVector<T> v) {
final int n = v.getDimension();
- SparseFieldMatrix<T> res = new SparseFieldMatrix<T>(field, virtualSize, n);
+ SparseFieldMatrix<T> res = new SparseFieldMatrix<>(field, virtualSize, n);
OpenIntToFieldHashMap<T>.Iterator iter = entries.iterator();
while (iter.hasNext()) {
iter.advance();
@@ -407,7 +407,7 @@ public class SparseFieldVector<T extends FieldElement<T>> implements FieldVector
return outerProduct((SparseFieldVector<T>)v);
} else {
final int n = v.getDimension();
- FieldMatrix<T> res = new SparseFieldMatrix<T>(field, virtualSize, n);
+ FieldMatrix<T> res = new SparseFieldMatrix<>(field, virtualSize, n);
OpenIntToFieldHashMap<T>.Iterator iter = entries.iterator();
while (iter.hasNext()) {
iter.advance();
@@ -495,7 +495,7 @@ public class SparseFieldVector<T extends FieldElement<T>> implements FieldVector
} else {
final int n = v.getDimension();
checkVectorDimensions(n);
- SparseFieldVector<T> res = new SparseFieldVector<T>(this);
+ SparseFieldVector<T> res = new SparseFieldVector<>(this);
for (int i = 0; i < n; i++) {
if (entries.containsKey(i)) {
res.setEntry(i, entries.get(i).subtract(v.getEntry(i)));
@@ -578,7 +578,7 @@ public class SparseFieldVector<T extends FieldElement<T>> implements FieldVector
} else {
final int n = v.getDimension();
checkVectorDimensions(n);
- SparseFieldVector<T> res = new SparseFieldVector<T>(field,
+ SparseFieldVector<T> res = new SparseFieldVector<>(field,
getDimension());
for (int i = 0; i < n; i++) {
res.setEntry(i, v.getEntry(i).add(getEntry(i)));
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ml/clustering/Cluster.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/Cluster.java b/src/main/java/org/apache/commons/math4/ml/clustering/Cluster.java
index bd264bb..f655065 100644
--- a/src/main/java/org/apache/commons/math4/ml/clustering/Cluster.java
+++ b/src/main/java/org/apache/commons/math4/ml/clustering/Cluster.java
@@ -38,7 +38,7 @@ public class Cluster<T extends Clusterable> implements Serializable {
* Build a cluster centered at a specified point.
*/
public Cluster() {
- points = new ArrayList<T>();
+ points = new ArrayList<>();
}
/**
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ml/clustering/DBSCANClusterer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/DBSCANClusterer.java b/src/main/java/org/apache/commons/math4/ml/clustering/DBSCANClusterer.java
index 1223be8..a561433 100644
--- a/src/main/java/org/apache/commons/math4/ml/clustering/DBSCANClusterer.java
+++ b/src/main/java/org/apache/commons/math4/ml/clustering/DBSCANClusterer.java
@@ -136,8 +136,8 @@ public class DBSCANClusterer<T extends Clusterable> extends Clusterer<T> {
// sanity checks
MathUtils.checkNotNull(points);
- final List<Cluster<T>> clusters = new ArrayList<Cluster<T>>();
- final Map<Clusterable, PointStatus> visited = new HashMap<Clusterable, PointStatus>();
+ final List<Cluster<T>> clusters = new ArrayList<>();
+ final Map<Clusterable, PointStatus> visited = new HashMap<>();
for (final T point : points) {
if (visited.get(point) != null) {
@@ -146,7 +146,7 @@ public class DBSCANClusterer<T extends Clusterable> extends Clusterer<T> {
final List<T> neighbors = getNeighbors(point, points);
if (neighbors.size() >= minPts) {
// DBSCAN does not care about center points
- final Cluster<T> cluster = new Cluster<T>();
+ final Cluster<T> cluster = new Cluster<>();
clusters.add(expandCluster(cluster, point, neighbors, points, visited));
} else {
visited.put(point, PointStatus.NOISE);
@@ -174,7 +174,7 @@ public class DBSCANClusterer<T extends Clusterable> extends Clusterer<T> {
cluster.addPoint(point);
visited.put(point, PointStatus.PART_OF_CLUSTER);
- List<T> seeds = new ArrayList<T>(neighbors);
+ List<T> seeds = new ArrayList<>(neighbors);
int index = 0;
while (index < seeds.size()) {
final T current = seeds.get(index);
@@ -205,7 +205,7 @@ public class DBSCANClusterer<T extends Clusterable> extends Clusterer<T> {
* @return the List of neighbors
*/
private List<T> getNeighbors(final T point, final Collection<T> points) {
- final List<T> neighbors = new ArrayList<T>();
+ final List<T> neighbors = new ArrayList<>();
for (final T neighbor : points) {
if (point != neighbor && distance(neighbor, point) <= eps) {
neighbors.add(neighbor);
@@ -222,7 +222,7 @@ public class DBSCANClusterer<T extends Clusterable> extends Clusterer<T> {
* @return merged lists
*/
private List<T> merge(final List<T> one, final List<T> two) {
- final Set<T> oneSet = new HashSet<T>(one);
+ final Set<T> oneSet = new HashSet<>(one);
for (T item : two) {
if (!oneSet.contains(item)) {
one.add(item);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.java b/src/main/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.java
index e57697f..7ef632f 100644
--- a/src/main/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.java
+++ b/src/main/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.java
@@ -279,8 +279,8 @@ public class FuzzyKMeansClusterer<T extends Clusterable> extends Clusterer<T> {
}
// copy the input collection to an unmodifiable list with indexed access
- points = Collections.unmodifiableList(new ArrayList<T>(dataPoints));
- clusters = new ArrayList<CentroidCluster<T>>();
+ points = Collections.unmodifiableList(new ArrayList<>(dataPoints));
+ clusters = new ArrayList<>();
membershipMatrix = new double[size][k];
final double[][] oldMatrix = new double[size][k];
@@ -316,7 +316,7 @@ public class FuzzyKMeansClusterer<T extends Clusterable> extends Clusterer<T> {
*/
private void updateClusterCenters() {
int j = 0;
- final List<CentroidCluster<T>> newClusters = new ArrayList<CentroidCluster<T>>(k);
+ final List<CentroidCluster<T>> newClusters = new ArrayList<>(k);
for (final CentroidCluster<T> cluster : clusters) {
final Clusterable center = cluster.getCenter();
int i = 0;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.java b/src/main/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.java
index 1901013..79dca8e 100644
--- a/src/main/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.java
+++ b/src/main/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.java
@@ -216,7 +216,7 @@ public class KMeansPlusPlusClusterer<T extends Clusterable> extends Clusterer<T>
final int max = (maxIterations < 0) ? Integer.MAX_VALUE : maxIterations;
for (int count = 0; count < max; count++) {
boolean emptyCluster = false;
- List<CentroidCluster<T>> newClusters = new ArrayList<CentroidCluster<T>>();
+ List<CentroidCluster<T>> newClusters = new ArrayList<>();
for (final CentroidCluster<T> cluster : clusters) {
final Clusterable newCenter;
if (cluster.getPoints().isEmpty()) {
@@ -288,7 +288,7 @@ public class KMeansPlusPlusClusterer<T extends Clusterable> extends Clusterer<T>
// Convert to list for indexed access. Make it unmodifiable, since removal of items
// would screw up the logic of this method.
- final List<T> pointList = Collections.unmodifiableList(new ArrayList<T> (points));
+ final List<T> pointList = Collections.unmodifiableList(new ArrayList<> (points));
// The number of points in the list.
final int numPoints = pointList.size();
@@ -298,7 +298,7 @@ public class KMeansPlusPlusClusterer<T extends Clusterable> extends Clusterer<T>
final boolean[] taken = new boolean[numPoints];
// The resulting list of initial centers.
- final List<CentroidCluster<T>> resultSet = new ArrayList<CentroidCluster<T>>();
+ final List<CentroidCluster<T>> resultSet = new ArrayList<>();
// Choose one center uniformly at random from among the data points.
final int firstPointIndex = random.nextInt(numPoints);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ml/neuralnet/MapUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/MapUtils.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/MapUtils.java
index d097edd..a793fa0 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/MapUtils.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/MapUtils.java
@@ -105,7 +105,7 @@ public class MapUtils {
}
}
- return new Pair<Neuron, Neuron>(best[0], best[1]);
+ return new Pair<>(best[0], best[1]);
}
/**
@@ -130,7 +130,7 @@ public class MapUtils {
public static Neuron[] sort(double[] features,
Iterable<Neuron> neurons,
DistanceMeasure distance) {
- final List<PairNeuronDouble> list = new ArrayList<PairNeuronDouble>();
+ final List<PairNeuronDouble> list = new ArrayList<>();
for (final Neuron n : neurons) {
final double d = distance.compute(n.getFeatures(), features);
@@ -196,7 +196,7 @@ public class MapUtils {
public static int[][] computeHitHistogram(Iterable<double[]> data,
NeuronSquareMesh2D map,
DistanceMeasure distance) {
- final HashMap<Neuron, Integer> hit = new HashMap<Neuron, Integer>();
+ final HashMap<Neuron, Integer> hit = new HashMap<>();
final Network net = map.getNetwork();
for (double[] f : data) {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ml/neuralnet/Network.java
----------------------------------------------------------------------
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 6dcd729..6da635e 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
@@ -51,14 +51,14 @@ public class Network
private static final long serialVersionUID = 20130207L;
/** Neurons. */
private final ConcurrentHashMap<Long, Neuron> neuronMap
- = new ConcurrentHashMap<Long, Neuron>();
+ = new ConcurrentHashMap<>();
/** Next available neuron identifier. */
private final AtomicLong nextId;
/** Neuron's features set size. */
private final int featureSize;
/** Links. */
private final ConcurrentHashMap<Long, Set<Long>> linkMap
- = new ConcurrentHashMap<Long, Set<Long>>();
+ = new ConcurrentHashMap<>();
/**
* Comparator that prescribes an order of the neurons according
@@ -155,7 +155,7 @@ public class Network
}
for (Map.Entry<Long, Set<Long>> e : linkMap.entrySet()) {
- copy.linkMap.put(e.getKey(), new HashSet<Long>(e.getValue()));
+ copy.linkMap.put(e.getKey(), new HashSet<>(e.getValue()));
}
return copy;
@@ -178,7 +178,7 @@ public class Network
* @see NeuronIdentifierComparator
*/
public Collection<Neuron> getNeurons(Comparator<Neuron> comparator) {
- final List<Neuron> neurons = new ArrayList<Neuron>();
+ final List<Neuron> neurons = new ArrayList<>();
neurons.addAll(neuronMap.values());
Collections.sort(neurons, comparator);
@@ -356,7 +356,7 @@ public class Network
*/
public Collection<Neuron> getNeighbours(Iterable<Neuron> neurons,
Iterable<Neuron> exclude) {
- final Set<Long> idList = new HashSet<Long>();
+ final Set<Long> idList = new HashSet<>();
for (Neuron n : neurons) {
idList.addAll(linkMap.get(n.getIdentifier()));
@@ -367,7 +367,7 @@ public class Network
}
}
- final List<Neuron> neuronList = new ArrayList<Neuron>();
+ final List<Neuron> neuronList = new ArrayList<>();
for (Long id : idList) {
neuronList.add(getNeuron(id));
}
@@ -403,7 +403,7 @@ public class Network
}
}
- final List<Neuron> neuronList = new ArrayList<Neuron>();
+ final List<Neuron> neuronList = new ArrayList<>();
for (Long id : idList) {
neuronList.add(getNeuron(id));
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ml/neuralnet/Neuron.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/Neuron.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/Neuron.java
index 56f1976..61b3aa1 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/Neuron.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/Neuron.java
@@ -63,7 +63,7 @@ public class Neuron implements Serializable {
double[] features) {
this.identifier = identifier;
this.size = features.length;
- this.features = new AtomicReference<double[]>(features.clone());
+ this.features = new AtomicReference<>(features.clone());
}
/**
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java
index 87e1bbc..1c49d06 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java
@@ -111,10 +111,10 @@ public class KohonenUpdateAction implements UpdateAction {
if (currentNeighbourhood > 0) {
// Initial set of neurons only contains the winning neuron.
- Collection<Neuron> neighbours = new HashSet<Neuron>();
+ Collection<Neuron> neighbours = new HashSet<>();
neighbours.add(best);
// Winning neuron must be excluded from the neighbours.
- final HashSet<Neuron> exclude = new HashSet<Neuron>();
+ final HashSet<Neuron> exclude = new HashSet<>();
exclude.add(best);
int radius = 1;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2D.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2D.java
index 38bd608..e42491d 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2D.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2D.java
@@ -423,7 +423,7 @@ public class NeuronSquareMesh2D
*/
private void createLinks() {
// "linkEnd" will store the identifiers of the "neighbours".
- final List<Long> linkEnd = new ArrayList<Long>();
+ final List<Long> linkEnd = new ArrayList<>();
final int iLast = numberOfRows - 1;
final int jLast = numberOfColumns - 1;
for (int i = 0; i < numberOfRows; i++) {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/util/LocationFinder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/util/LocationFinder.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/util/LocationFinder.java
index fa02e3a..7785f7b 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/util/LocationFinder.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/util/LocationFinder.java
@@ -29,7 +29,7 @@ import org.apache.commons.math4.exception.MathIllegalStateException;
*/
public class LocationFinder {
/** Identifier to location mapping. */
- private final Map<Long, Location> locations = new HashMap<Long, Location>();
+ private final Map<Long, Location> locations = new HashMap<>();
/**
* Container holding a (row, column) pair.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java b/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
index c61da98..2475a48 100644
--- a/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
@@ -95,10 +95,10 @@ public abstract class AbstractFieldIntegrator<T extends RealFieldElement<T>> imp
protected AbstractFieldIntegrator(final Field<T> field, final String name) {
this.field = field;
this.name = name;
- stepHandlers = new ArrayList<FieldStepHandler<T>>();
+ stepHandlers = new ArrayList<>();
stepStart = null;
stepSize = null;
- eventsStates = new ArrayList<FieldEventState<T>>();
+ eventsStates = new ArrayList<>();
statesInitialized = false;
evaluations = IntegerSequence.Incrementor.create().withMaximalCount(Integer.MAX_VALUE);
}
@@ -142,7 +142,7 @@ public abstract class AbstractFieldIntegrator<T extends RealFieldElement<T>> imp
final int maxIterationCount) {
addEventHandler(handler, maxCheckInterval, convergence,
maxIterationCount,
- new FieldBracketingNthOrderBrentSolver<T>(field.getZero().add(DEFAULT_RELATIVE_ACCURACY),
+ new FieldBracketingNthOrderBrentSolver<>(field.getZero().add(DEFAULT_RELATIVE_ACCURACY),
field.getZero().add(convergence),
field.getZero().add(DEFAULT_FUNCTION_VALUE_ACCURACY),
5));
@@ -155,14 +155,14 @@ public abstract class AbstractFieldIntegrator<T extends RealFieldElement<T>> imp
final double convergence,
final int maxIterationCount,
final BracketedRealFieldUnivariateSolver<T> solver) {
- eventsStates.add(new FieldEventState<T>(handler, maxCheckInterval, field.getZero().add(convergence),
+ eventsStates.add(new FieldEventState<>(handler, maxCheckInterval, field.getZero().add(convergence),
maxIterationCount, solver));
}
/** {@inheritDoc} */
@Override
public Collection<FieldEventHandler<T>> getEventHandlers() {
- final List<FieldEventHandler<T>> list = new ArrayList<FieldEventHandler<T>>(eventsStates.size());
+ final List<FieldEventHandler<T>> list = new ArrayList<>(eventsStates.size());
for (FieldEventState<T> state : eventsStates) {
list.add(state.getEventHandler());
}
@@ -223,7 +223,7 @@ public abstract class AbstractFieldIntegrator<T extends RealFieldElement<T>> imp
// set up derivatives of initial state
final T[] y0Dot = computeDerivatives(t0, y0);
- final FieldODEStateAndDerivative<T> state0 = new FieldODEStateAndDerivative<T>(t0, y0, y0Dot);
+ final FieldODEStateAndDerivative<T> state0 = new FieldODEStateAndDerivative<>(t0, y0, y0Dot);
// initialize event handlers
for (final FieldEventState<T> state : eventsStates) {
@@ -307,7 +307,7 @@ public abstract class AbstractFieldIntegrator<T extends RealFieldElement<T>> imp
// search for next events that may occur during the step
final int orderingSign = interpolator.isForward() ? +1 : -1;
- SortedSet<FieldEventState<T>> occurringEvents = new TreeSet<FieldEventState<T>>(new Comparator<FieldEventState<T>>() {
+ SortedSet<FieldEventState<T>> occurringEvents = new TreeSet<>(new Comparator<FieldEventState<T>>() {
/** {@inheritDoc} */
@Override
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java b/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java
index 072889a..e4dd02f 100644
--- a/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java
@@ -82,10 +82,10 @@ public abstract class AbstractIntegrator implements FirstOrderIntegrator {
*/
public AbstractIntegrator(final String name) {
this.name = name;
- stepHandlers = new ArrayList<StepHandler>();
+ stepHandlers = new ArrayList<>();
stepStart = Double.NaN;
stepSize = Double.NaN;
- eventsStates = new ArrayList<EventState>();
+ eventsStates = new ArrayList<>();
statesInitialized = false;
evaluations = IntegerSequence.Incrementor.create().withMaximalCount(Integer.MAX_VALUE);
}
@@ -145,7 +145,7 @@ public abstract class AbstractIntegrator implements FirstOrderIntegrator {
/** {@inheritDoc} */
@Override
public Collection<EventHandler> getEventHandlers() {
- final List<EventHandler> list = new ArrayList<EventHandler>(eventsStates.size());
+ final List<EventHandler> list = new ArrayList<>(eventsStates.size());
for (EventState state : eventsStates) {
list.add(state.getEventHandler());
}
@@ -341,7 +341,7 @@ public abstract class AbstractIntegrator implements FirstOrderIntegrator {
// search for next events that may occur during the step
final int orderingSign = interpolator.isForward() ? +1 : -1;
- SortedSet<EventState> occurringEvents = new TreeSet<EventState>(new Comparator<EventState>() {
+ SortedSet<EventState> occurringEvents = new TreeSet<>(new Comparator<EventState>() {
/** {@inheritDoc} */
@Override
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ode/AbstractParameterizable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/AbstractParameterizable.java b/src/main/java/org/apache/commons/math4/ode/AbstractParameterizable.java
index 5b4aea7..c21365d 100644
--- a/src/main/java/org/apache/commons/math4/ode/AbstractParameterizable.java
+++ b/src/main/java/org/apache/commons/math4/ode/AbstractParameterizable.java
@@ -33,7 +33,7 @@ public abstract class AbstractParameterizable implements Parameterizable {
* @param names names of the supported parameters
*/
protected AbstractParameterizable(final String ... names) {
- parametersNames = new ArrayList<String>();
+ parametersNames = new ArrayList<>();
for (final String name : names) {
parametersNames.add(name);
}
@@ -43,7 +43,7 @@ public abstract class AbstractParameterizable implements Parameterizable {
* @param names names of the supported parameters
*/
protected AbstractParameterizable(final Collection<String> names) {
- parametersNames = new ArrayList<String>();
+ parametersNames = new ArrayList<>();
parametersNames.addAll(names);
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ode/ContinuousOutputFieldModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/ContinuousOutputFieldModel.java b/src/main/java/org/apache/commons/math4/ode/ContinuousOutputFieldModel.java
index e8b96a1..b1d8be2 100644
--- a/src/main/java/org/apache/commons/math4/ode/ContinuousOutputFieldModel.java
+++ b/src/main/java/org/apache/commons/math4/ode/ContinuousOutputFieldModel.java
@@ -100,7 +100,7 @@ public class ContinuousOutputFieldModel<T extends RealFieldElement<T>>
* Build an empty continuous output model.
*/
public ContinuousOutputFieldModel() {
- steps = new ArrayList<FieldStepInterpolator<T>>();
+ steps = new ArrayList<>();
initialTime = null;
finalTime = null;
forward = true;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ode/ContinuousOutputModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/ContinuousOutputModel.java b/src/main/java/org/apache/commons/math4/ode/ContinuousOutputModel.java
index e48dff9..8f63847 100644
--- a/src/main/java/org/apache/commons/math4/ode/ContinuousOutputModel.java
+++ b/src/main/java/org/apache/commons/math4/ode/ContinuousOutputModel.java
@@ -111,7 +111,7 @@ public class ContinuousOutputModel
* Build an empty continuous output model.
*/
public ContinuousOutputModel() {
- steps = new ArrayList<StepInterpolator>();
+ steps = new ArrayList<>();
initialTime = Double.NaN;
finalTime = Double.NaN;
forward = true;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ode/ExpandableStatefulODE.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/ExpandableStatefulODE.java b/src/main/java/org/apache/commons/math4/ode/ExpandableStatefulODE.java
index 77e50bc..476b9ff 100644
--- a/src/main/java/org/apache/commons/math4/ode/ExpandableStatefulODE.java
+++ b/src/main/java/org/apache/commons/math4/ode/ExpandableStatefulODE.java
@@ -76,7 +76,7 @@ public class ExpandableStatefulODE {
this.time = Double.NaN;
this.primaryState = new double[n];
this.primaryStateDot = new double[n];
- this.components = new ArrayList<ExpandableStatefulODE.SecondaryComponent>();
+ this.components = new ArrayList<>();
}
/** Get the primary set of differential equations.
@@ -138,7 +138,7 @@ public class ExpandableStatefulODE {
final int firstIndex;
if (components.isEmpty()) {
// lazy creation of the components list
- components = new ArrayList<ExpandableStatefulODE.SecondaryComponent>();
+ components = new ArrayList<>();
firstIndex = primary.getDimension();
} else {
final SecondaryComponent last = components.get(components.size() - 1);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ode/FieldEquationsMapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/FieldEquationsMapper.java b/src/main/java/org/apache/commons/math4/ode/FieldEquationsMapper.java
index 1febe7d..cafdd66 100644
--- a/src/main/java/org/apache/commons/math4/ode/FieldEquationsMapper.java
+++ b/src/main/java/org/apache/commons/math4/ode/FieldEquationsMapper.java
@@ -130,7 +130,7 @@ public class FieldEquationsMapper<T extends RealFieldElement<T>> implements Seri
final T[] state = extractEquationData(index, y);
final T[] derivative = extractEquationData(index, yDot);
if (n < 2) {
- return new FieldODEStateAndDerivative<T>(t, state, derivative);
+ return new FieldODEStateAndDerivative<>(t, state, derivative);
} else {
final T[][] secondaryState = MathArrays.buildArray(t.getField(), n - 1, -1);
final T[][] secondaryDerivative = MathArrays.buildArray(t.getField(), n - 1, -1);
@@ -138,7 +138,7 @@ public class FieldEquationsMapper<T extends RealFieldElement<T>> implements Seri
secondaryState[index - 1] = extractEquationData(index, y);
secondaryDerivative[index - 1] = extractEquationData(index, yDot);
}
- return new FieldODEStateAndDerivative<T>(t, state, derivative, secondaryState, secondaryDerivative);
+ return new FieldODEStateAndDerivative<>(t, state, derivative, secondaryState, secondaryDerivative);
}
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java b/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java
index e5dd205..8dddaad 100644
--- a/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java
+++ b/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java
@@ -65,8 +65,8 @@ public class FieldExpandableODE<T extends RealFieldElement<T>> {
*/
public FieldExpandableODE(final FirstOrderFieldDifferentialEquations<T> primary) {
this.primary = primary;
- this.components = new ArrayList<FieldSecondaryEquations<T>>();
- this.mapper = new FieldEquationsMapper<T>(null, primary.getDimension());
+ this.components = new ArrayList<>();
+ this.mapper = new FieldEquationsMapper<>(null, primary.getDimension());
}
/** Get the mapper for the set of equations.
@@ -86,7 +86,7 @@ public class FieldExpandableODE<T extends RealFieldElement<T>> {
public int addSecondaryEquations(final FieldSecondaryEquations<T> secondary) {
components.add(secondary);
- mapper = new FieldEquationsMapper<T>(mapper, secondary.getDimension());
+ mapper = new FieldEquationsMapper<>(mapper, secondary.getDimension());
return components.size();
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ode/JacobianMatrices.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/JacobianMatrices.java b/src/main/java/org/apache/commons/math4/ode/JacobianMatrices.java
index 1296620..2efed92 100644
--- a/src/main/java/org/apache/commons/math4/ode/JacobianMatrices.java
+++ b/src/main/java/org/apache/commons/math4/ode/JacobianMatrices.java
@@ -141,7 +141,7 @@ public class JacobianMatrices {
}
this.dirtyParameter = false;
- this.jacobianProviders = new ArrayList<ParameterJacobianProvider>();
+ this.jacobianProviders = new ArrayList<>();
// set the default initial state Jacobian to the identity
// and the default initial parameters Jacobian to the null matrix
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java b/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java
index fdb1d90..edd65e2 100644
--- a/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java
@@ -130,7 +130,7 @@ public abstract class MultistepFieldIntegrator<T extends RealFieldElement<T>>
nSteps, 2, true);
}
- starter = new DormandPrince853FieldIntegrator<T>(field, minStep, maxStep,
+ starter = new DormandPrince853FieldIntegrator<>(field, minStep, maxStep,
scalAbsoluteTolerance,
scalRelativeTolerance);
this.nSteps = nSteps;
@@ -170,7 +170,7 @@ public abstract class MultistepFieldIntegrator<T extends RealFieldElement<T>>
final double[] vecAbsoluteTolerance,
final double[] vecRelativeTolerance) {
super(field, name, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance);
- starter = new DormandPrince853FieldIntegrator<T>(field, minStep, maxStep,
+ starter = new DormandPrince853FieldIntegrator<>(field, minStep, maxStep,
vecAbsoluteTolerance,
vecRelativeTolerance);
this.nSteps = nSteps;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ode/ParameterJacobianWrapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/ParameterJacobianWrapper.java b/src/main/java/org/apache/commons/math4/ode/ParameterJacobianWrapper.java
index d555aa4..e28c185 100644
--- a/src/main/java/org/apache/commons/math4/ode/ParameterJacobianWrapper.java
+++ b/src/main/java/org/apache/commons/math4/ode/ParameterJacobianWrapper.java
@@ -51,7 +51,7 @@ class ParameterJacobianWrapper implements ParameterJacobianProvider {
final ParameterConfiguration[] paramsAndSteps) {
this.fode = fode;
this.pode = pode;
- this.hParam = new HashMap<String, Double>();
+ this.hParam = new HashMap<>();
// set up parameters for jacobian computation
for (final ParameterConfiguration param : paramsAndSteps) {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ode/ParameterizedWrapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/ParameterizedWrapper.java b/src/main/java/org/apache/commons/math4/ode/ParameterizedWrapper.java
index c306ec8..0d2521d 100644
--- a/src/main/java/org/apache/commons/math4/ode/ParameterizedWrapper.java
+++ b/src/main/java/org/apache/commons/math4/ode/ParameterizedWrapper.java
@@ -61,7 +61,7 @@ class ParameterizedWrapper implements ParameterizedODE {
/** {@inheritDoc} */
@Override
public Collection<String> getParametersNames() {
- return new ArrayList<String>();
+ return new ArrayList<>();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegrator.java
index 977573e..ebb31f0 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegrator.java
@@ -301,7 +301,7 @@ public class AdamsBashforthFieldIntegrator<T extends RealFieldElement<T>> extend
}
// discrete events handling
- setStepStart(acceptStep(new AdamsFieldStepInterpolator<T>(getStepSize(), stepEnd,
+ setStepStart(acceptStep(new AdamsFieldStepInterpolator<>(getStepSize(), stepEnd,
predictedScaled, predictedNordsieck, forward,
getStepStart(), stepEnd,
equations.getMapper()),