Use "valueOf".
Call to constructor is deprecated in Java 11.
This commit is contained in:
parent
aa58ab0fd6
commit
5460d4d755
|
@ -246,57 +246,57 @@ public class MathArraysTest {
|
|||
|
||||
@Test
|
||||
public void testIsMonotonicComparable() {
|
||||
Assert.assertFalse(MathArrays.isMonotonic(new Double[] {new Double(-15),
|
||||
new Double(-5.5),
|
||||
new Double(-1),
|
||||
new Double(-1),
|
||||
new Double(2),
|
||||
new Double(15) },
|
||||
Assert.assertFalse(MathArrays.isMonotonic(new Double[] {Double.valueOf(-15),
|
||||
Double.valueOf(-5.5),
|
||||
Double.valueOf(-1),
|
||||
Double.valueOf(-1),
|
||||
Double.valueOf(2),
|
||||
Double.valueOf(15) },
|
||||
MathArrays.OrderDirection.INCREASING, true));
|
||||
Assert.assertTrue(MathArrays.isMonotonic(new Double[] {new Double(-15),
|
||||
new Double(-5.5),
|
||||
new Double(-1),
|
||||
new Double(0),
|
||||
new Double(2),
|
||||
new Double(15) },
|
||||
Assert.assertTrue(MathArrays.isMonotonic(new Double[] {Double.valueOf(-15),
|
||||
Double.valueOf(-5.5),
|
||||
Double.valueOf(-1),
|
||||
Double.valueOf(0),
|
||||
Double.valueOf(2),
|
||||
Double.valueOf(15) },
|
||||
MathArrays.OrderDirection.INCREASING, true));
|
||||
Assert.assertFalse(MathArrays.isMonotonic(new Double[] {new Double(-15),
|
||||
new Double(-5.5),
|
||||
new Double(-1),
|
||||
new Double(-2),
|
||||
new Double(2) },
|
||||
Assert.assertFalse(MathArrays.isMonotonic(new Double[] {Double.valueOf(-15),
|
||||
Double.valueOf(-5.5),
|
||||
Double.valueOf(-1),
|
||||
Double.valueOf(-2),
|
||||
Double.valueOf(2) },
|
||||
MathArrays.OrderDirection.INCREASING, false));
|
||||
Assert.assertTrue(MathArrays.isMonotonic(new Double[] {new Double(-15),
|
||||
new Double(-5.5),
|
||||
new Double(-1),
|
||||
new Double(-1),
|
||||
new Double(2) },
|
||||
Assert.assertTrue(MathArrays.isMonotonic(new Double[] {Double.valueOf(-15),
|
||||
Double.valueOf(-5.5),
|
||||
Double.valueOf(-1),
|
||||
Double.valueOf(-1),
|
||||
Double.valueOf(2) },
|
||||
MathArrays.OrderDirection.INCREASING, false));
|
||||
Assert.assertFalse(MathArrays.isMonotonic(new Double[] {new Double(3),
|
||||
new Double(3),
|
||||
new Double(-5.5),
|
||||
new Double(-11),
|
||||
new Double(-27.5) },
|
||||
Assert.assertFalse(MathArrays.isMonotonic(new Double[] {Double.valueOf(3),
|
||||
Double.valueOf(3),
|
||||
Double.valueOf(-5.5),
|
||||
Double.valueOf(-11),
|
||||
Double.valueOf(-27.5) },
|
||||
MathArrays.OrderDirection.DECREASING, true));
|
||||
Assert.assertTrue(MathArrays.isMonotonic(new Double[] {new Double(3),
|
||||
new Double(2),
|
||||
new Double(-5.5),
|
||||
new Double(-11),
|
||||
new Double(-27.5) },
|
||||
Assert.assertTrue(MathArrays.isMonotonic(new Double[] {Double.valueOf(3),
|
||||
Double.valueOf(2),
|
||||
Double.valueOf(-5.5),
|
||||
Double.valueOf(-11),
|
||||
Double.valueOf(-27.5) },
|
||||
MathArrays.OrderDirection.DECREASING, true));
|
||||
Assert.assertFalse(MathArrays.isMonotonic(new Double[] {new Double(3),
|
||||
new Double(-1),
|
||||
new Double(0),
|
||||
new Double(-5.5),
|
||||
new Double(-11),
|
||||
new Double(-27.5) },
|
||||
Assert.assertFalse(MathArrays.isMonotonic(new Double[] {Double.valueOf(3),
|
||||
Double.valueOf(-1),
|
||||
Double.valueOf(0),
|
||||
Double.valueOf(-5.5),
|
||||
Double.valueOf(-11),
|
||||
Double.valueOf(-27.5) },
|
||||
MathArrays.OrderDirection.DECREASING, false));
|
||||
Assert.assertTrue(MathArrays.isMonotonic(new Double[] {new Double(3),
|
||||
new Double(0),
|
||||
new Double(0),
|
||||
new Double(-5.5),
|
||||
new Double(-11),
|
||||
new Double(-27.5) },
|
||||
Assert.assertTrue(MathArrays.isMonotonic(new Double[] {Double.valueOf(3),
|
||||
Double.valueOf(0),
|
||||
Double.valueOf(0),
|
||||
Double.valueOf(-5.5),
|
||||
Double.valueOf(-11),
|
||||
Double.valueOf(-27.5) },
|
||||
MathArrays.OrderDirection.DECREASING, false));
|
||||
}
|
||||
|
||||
|
|
|
@ -27,15 +27,15 @@ public class PairTest {
|
|||
@Test
|
||||
public void testAccessor() {
|
||||
final Pair<Integer, Double> p
|
||||
= new Pair<>(new Integer(1), new Double(2));
|
||||
Assert.assertEquals(new Integer(1), p.getKey());
|
||||
= new Pair<>(Integer.valueOf(1), Double.valueOf(2));
|
||||
Assert.assertEquals(Integer.valueOf(1), p.getKey());
|
||||
Assert.assertEquals(2, p.getValue().doubleValue(), Math.ulp(1d));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAccessor2() {
|
||||
final Pair<Integer, Double> p
|
||||
= new Pair<>(new Integer(1), new Double(2));
|
||||
= new Pair<>(Integer.valueOf(1), Double.valueOf(2));
|
||||
|
||||
// Check that both APIs refer to the same data.
|
||||
|
||||
|
@ -51,13 +51,13 @@ public class PairTest {
|
|||
Pair<Integer, Double> p2 = new Pair<>(null, null);
|
||||
Assert.assertEquals(p1, p2);
|
||||
|
||||
p1 = new Pair<>(new Integer(1), new Double(2));
|
||||
p1 = new Pair<>(Integer.valueOf(1), Double.valueOf(2));
|
||||
Assert.assertNotEquals(p1, p2);
|
||||
|
||||
p2 = new Pair<>(new Integer(1), new Double(2));
|
||||
p2 = new Pair<>(Integer.valueOf(1), Double.valueOf(2));
|
||||
Assert.assertEquals(p1, p2);
|
||||
|
||||
Pair<Integer, Float> p3 = new Pair<>(new Integer(1), new Float(2));
|
||||
Pair<Integer, Float> p3 = new Pair<>(Integer.valueOf(1), Float.valueOf(2));
|
||||
Assert.assertNotEquals(p1, p3);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue