From 298e3f8d2c22d63f6d4c96256d58dee0a63d1ef6 Mon Sep 17 00:00:00 2001 From: mlrprananta Date: Tue, 9 May 2023 16:49:04 +0200 Subject: [PATCH] Suggestion --- .../errorprone/refasterrules/StreamRules.java | 13 +------------ .../refasterrules/StreamRulesTestInput.java | 4 ---- .../refasterrules/StreamRulesTestOutput.java | 4 ---- 3 files changed, 1 insertion(+), 20 deletions(-) diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/StreamRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/StreamRules.java index a55c1027924..1eaafc41e29 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/StreamRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/StreamRules.java @@ -625,20 +625,9 @@ R after( } } - static final class StreamConcat { - @BeforeTemplate - Stream before(Stream s1, Stream s2) { - return Stream.of(s1, s2).flatMap(Function.identity()); - } - - @AfterTemplate - Stream after(Stream s1, Stream s2) { - return Stream.concat(s1, s2); - } - } - static final class StreamsConcat { @BeforeTemplate + @SuppressWarnings("StreamOfArray") Stream before(@Repeated Stream stream) { return Stream.of(Refaster.asVarargs(stream)).flatMap(Function.identity()); } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/StreamRulesTestInput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/StreamRulesTestInput.java index e4aa2da0e94..b3c3bfee94a 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/StreamRulesTestInput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/StreamRulesTestInput.java @@ -251,10 +251,6 @@ ImmutableSet testStreamFlatMapCollect() { return Stream.of(1).collect(flatMapping(n -> Stream.of(n, n), toImmutableSet())); } - Stream testStreamConcat() { - return Stream.of(Stream.of(1), Stream.of(2)).flatMap(Function.identity()); - } - Stream testStreamsConcat() { return Stream.of(Stream.of(1), Stream.of(2), Stream.of(3), Stream.of(4)) .flatMap(Function.identity()); diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/StreamRulesTestOutput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/StreamRulesTestOutput.java index 3c7260f3719..14066851e8f 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/StreamRulesTestOutput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/StreamRulesTestOutput.java @@ -252,10 +252,6 @@ ImmutableSet testStreamFlatMapCollect() { return Stream.of(1).flatMap(n -> Stream.of(n, n)).collect(toImmutableSet()); } - Stream testStreamConcat() { - return Stream.concat(Stream.of(1), Stream.of(2)); - } - Stream testStreamsConcat() { return Streams.concat(Stream.of(1), Stream.of(2), Stream.of(3), Stream.of(4)); }