mirror of
https://github.com/TheAlgorithms/Java.git
synced 2026-03-13 08:40:43 +08:00
General performance improvement (#6078)
This commit is contained in:
committed by
GitHub
parent
7b962a4a1d
commit
df0c997e4b
@@ -1,5 +1,6 @@
|
||||
package com.thealgorithms.maths;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -27,8 +28,8 @@ public class ChineseRemainderTheoremTest {
|
||||
|
||||
@Test
|
||||
public void testCRTWithSingleCongruence() {
|
||||
List<Integer> remainders = Arrays.asList(4);
|
||||
List<Integer> moduli = Arrays.asList(7);
|
||||
List<Integer> remainders = singletonList(4);
|
||||
List<Integer> moduli = singletonList(7);
|
||||
int expected = 4;
|
||||
int result = ChineseRemainderTheorem.solveCRT(remainders, moduli);
|
||||
assertEquals(expected, result);
|
||||
|
||||
@@ -59,8 +59,7 @@ class MeansTest {
|
||||
|
||||
@Test
|
||||
void geometricMeanMultipleNumbers() {
|
||||
LinkedList<Double> numbers = new LinkedList<>();
|
||||
numbers.addAll(Lists.newArrayList(1d, 2d, 3d, 4d, 5d, 6d, 1.25));
|
||||
LinkedList<Double> numbers = new LinkedList<>(Lists.newArrayList(1d, 2d, 3d, 4d, 5d, 6d, 1.25));
|
||||
assertEquals(2.6426195539300585, Means.geometric(numbers));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user