General performance improvement (#6078)

This commit is contained in:
Strange Developer
2024-11-01 18:52:42 +01:00
committed by GitHub
parent 7b962a4a1d
commit df0c997e4b
29 changed files with 92 additions and 75 deletions

View File

@@ -1,9 +1,11 @@
package com.thealgorithms.greedyalgorithms;
import static java.util.Collections.singletonList;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.Test;
public class ActivitySelectionTest {
@@ -24,7 +26,7 @@ public class ActivitySelectionTest {
int[] end = {2};
ArrayList<Integer> result = ActivitySelection.activitySelection(start, end);
ArrayList<Integer> expected = new ArrayList<>(Arrays.asList(0));
List<Integer> expected = singletonList(0);
assertEquals(expected, result);
}

View File

@@ -1,9 +1,11 @@
package com.thealgorithms.greedyalgorithms;
import static java.util.Collections.singletonList;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.Test;
public class CoinChangeTest {
@@ -16,7 +18,7 @@ public class CoinChangeTest {
@Test
public void testCoinChangeProblemWithLargeAmount() {
ArrayList<Integer> expected = new ArrayList<>(Arrays.asList(2000));
List<Integer> expected = singletonList(2000);
ArrayList<Integer> coins = CoinChange.coinChangeProblem(2000);
assertEquals(expected, coins);
}