You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2022/10/13 12:42:19 UTC
[commons-numbers] 01/02: Use diamond operator
This is an automated email from the ASF dual-hosted git repository.
aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git
commit 0cd0545886661c8efbecdb55726dddbb0b0321a6
Author: aherbert <ah...@apache.org>
AuthorDate: Thu Oct 13 11:13:46 2022 +0100
Use diamond operator
---
.../apache/commons/numbers/primes/SmallPrimesTest.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/commons-numbers-primes/src/test/java/org/apache/commons/numbers/primes/SmallPrimesTest.java b/commons-numbers-primes/src/test/java/org/apache/commons/numbers/primes/SmallPrimesTest.java
index 8ba4e7a7..7bf1af30 100644
--- a/commons-numbers-primes/src/test/java/org/apache/commons/numbers/primes/SmallPrimesTest.java
+++ b/commons-numbers-primes/src/test/java/org/apache/commons/numbers/primes/SmallPrimesTest.java
@@ -31,7 +31,7 @@ class SmallPrimesTest {
@Test
void smallTrialDivision_smallComposite() {
- final List<Integer> factors = new ArrayList<Integer>();
+ final List<Integer> factors = new ArrayList<>();
final int result = SmallPrimes.smallTrialDivision(3 * 7 * 23, factors);
Assertions.assertEquals(1, result);
Assertions.assertEquals(Arrays.asList(3, 7, 23), factors);
@@ -39,7 +39,7 @@ class SmallPrimesTest {
@Test
void smallTrialDivision_repeatedFactors() {
- final List<Integer> factors = new ArrayList<Integer>();
+ final List<Integer> factors = new ArrayList<>();
final int result = SmallPrimes.smallTrialDivision(2 * 2 * 3 * 3 * 3, factors);
Assertions.assertEquals(1, result);
Assertions.assertEquals(Arrays.asList(2, 2, 3, 3, 3), factors);
@@ -47,7 +47,7 @@ class SmallPrimesTest {
@Test
void smallTrialDivision_oneFactor() {
- final List<Integer> factors = new ArrayList<Integer>();
+ final List<Integer> factors = new ArrayList<>();
final int result = SmallPrimes.smallTrialDivision(59, factors);
Assertions.assertEquals(1, result);
Assertions.assertEquals(Collections.singletonList(59), factors);
@@ -55,7 +55,7 @@ class SmallPrimesTest {
@Test
void smallTrialDivision_BoundaryPrimes() {
- final List<Integer> factors = new ArrayList<Integer>();
+ final List<Integer> factors = new ArrayList<>();
final int penultimatePrime = SmallPrimes.PRIMES[SmallPrimes.PRIMES.length - 2];
final int result = SmallPrimes.smallTrialDivision(penultimatePrime * SmallPrimes.PRIMES_LAST, factors);
Assertions.assertEquals(1, result);
@@ -64,7 +64,7 @@ class SmallPrimesTest {
@Test
void smallTrialDivision_largeComposite() {
- final List<Integer> factors = new ArrayList<Integer>();
+ final List<Integer> factors = new ArrayList<>();
final int result = SmallPrimes.smallTrialDivision(2 * 5 * LARGE_PRIME[0], factors);
Assertions.assertEquals(LARGE_PRIME[0], result);
Assertions.assertEquals(Arrays.asList(2, 5), factors);
@@ -72,7 +72,7 @@ class SmallPrimesTest {
@Test
void smallTrialDivision_noSmallPrimeFactors() {
- final List<Integer> factors = new ArrayList<Integer>();
+ final List<Integer> factors = new ArrayList<>();
final int result = SmallPrimes.smallTrialDivision(LARGE_PRIME[0] * LARGE_PRIME[1], factors);
Assertions.assertEquals(LARGE_PRIME[0] * LARGE_PRIME[1], result);
Assertions.assertEquals(Collections.<Integer>emptyList(), factors);
@@ -80,7 +80,7 @@ class SmallPrimesTest {
@Test
void boundedTrialDivision_twoDifferentFactors() {
- final List<Integer> factors = new ArrayList<Integer>();
+ final List<Integer> factors = new ArrayList<>();
final int result = SmallPrimes.boundedTrialDivision(LARGE_PRIME[0] * LARGE_PRIME[1], Integer.MAX_VALUE,
factors);
Assertions.assertEquals(LARGE_PRIME[1], result);
@@ -89,7 +89,7 @@ class SmallPrimesTest {
@Test
void boundedTrialDivision_square() {
- final List<Integer> factors = new ArrayList<Integer>();
+ final List<Integer> factors = new ArrayList<>();
final int result = SmallPrimes.boundedTrialDivision(LARGE_PRIME[0] * LARGE_PRIME[0], Integer.MAX_VALUE,
factors);
Assertions.assertEquals(LARGE_PRIME[0], result);