aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorPierre <pierre.guillot@sonarsource.com>2023-07-06 16:33:40 +0200
committersonartech <sonartech@sonarsource.com>2023-07-17 20:03:45 +0000
commit30b98e2afca3a56f4b52f79f483a3b5ab353ece3 (patch)
treea60a8d3f857e22590e3265741df1174b5c86b3f7 /sonar-core
parent76a58bd6272c27cda372e7b0da96404501f2adcb (diff)
downloadsonarqube-30b98e2afca3a56f4b52f79f483a3b5ab353ece3.tar.gz
sonarqube-30b98e2afca3a56f4b52f79f483a3b5ab353ece3.zip
NO-JIRA replace MoreCollectors.toArrayList(size) with Collectors.toList
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/util/stream/MoreCollectors.java4
-rw-r--r--sonar-core/src/test/java/org/sonar/core/util/stream/MoreCollectorsTest.java14
2 files changed, 0 insertions, 18 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/util/stream/MoreCollectors.java b/sonar-core/src/main/java/org/sonar/core/util/stream/MoreCollectors.java
index a5d8bbc98c6..b21fcbfcc9e 100644
--- a/sonar-core/src/main/java/org/sonar/core/util/stream/MoreCollectors.java
+++ b/sonar-core/src/main/java/org/sonar/core/util/stream/MoreCollectors.java
@@ -57,10 +57,6 @@ public final class MoreCollectors {
return Collectors.toCollection(() -> EnumSet.noneOf(enumClass));
}
- public static <T> Collector<T, ?, ArrayList<T>> toArrayList(int size) {
- return java.util.stream.Collectors.toCollection(() -> new ArrayList<>(size));
- }
-
public static <T> Collector<T, ?, HashSet<T>> toHashSet() {
return java.util.stream.Collectors.toCollection(HashSet::new);
}
diff --git a/sonar-core/src/test/java/org/sonar/core/util/stream/MoreCollectorsTest.java b/sonar-core/src/test/java/org/sonar/core/util/stream/MoreCollectorsTest.java
index eb42825ee15..26195f9903e 100644
--- a/sonar-core/src/test/java/org/sonar/core/util/stream/MoreCollectorsTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/util/stream/MoreCollectorsTest.java
@@ -22,7 +22,6 @@ package org.sonar.core.util.stream;
import com.google.common.base.Joiner;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.SetMultimap;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.EnumSet;
@@ -41,7 +40,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.Assertions.entry;
import static org.sonar.core.util.stream.MoreCollectors.index;
import static org.sonar.core.util.stream.MoreCollectors.join;
-import static org.sonar.core.util.stream.MoreCollectors.toArrayList;
import static org.sonar.core.util.stream.MoreCollectors.toHashSet;
import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex;
import static org.sonar.core.util.stream.MoreCollectors.unorderedFlattenIndex;
@@ -81,18 +79,6 @@ public class MoreCollectorsTest {
}
@Test
- public void toArrayList_with_size_builds_an_ArrayList() {
- List<Integer> res = Stream.of(1, 2, 3, 4, 5).collect(toArrayList(30));
- assertThat(res).isInstanceOf(ArrayList.class)
- .containsExactly(1, 2, 3, 4, 5);
- }
-
- @Test
- public void toArrayList_with_size_parallel_stream() {
- assertThat(HUGE_LIST.parallelStream().collect(toArrayList(HUGE_LIST.size()))).isEqualTo(HUGE_LIST);
- }
-
- @Test
public void toHashSet_builds_an_HashSet() {
Set<Integer> res = Stream.of(1, 2, 3, 4, 5).collect(toHashSet());
assertThat(res).isInstanceOf(HashSet.class)