This is an automated email from the ASF dual-hosted git repository.
He-Pin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-connectors.git
The following commit(s) were added to refs/heads/main by this push:
new 9dd039cc6 refactor: migrate Collections/Arrays.asList to Java 9+
collection factories (#1717)
9dd039cc6 is described below
commit 9dd039cc65ca4f1cfbfdc435bed26ae9ac09086c
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Fri Jun 26 21:05:51 2026 +0800
refactor: migrate Collections/Arrays.asList to Java 9+ collection factories
(#1717)
* refactor: migrate Collections/Arrays.asList to Java 9+ factory methods
Motivation:
Java 9+ provides List.of(), Map.of(), Set.of() factory methods that are
more concise and return truly immutable collections.
Modification:
Replace Arrays.asList() with List.of() across 48 files (212 occurrences).
Replace Collections.emptyList/Map/Set() and singletonList() with
List/Map/Set.of() across 12 files. Update imports accordingly.
Result:
Cleaner code using Java 17 immutable collection factories.
Tests:
Not run - compile-only test file changes
References:
None - Java 17 API modernization
* fix: revert Collections.emptySet/emptyMap/emptyList to original API
Motivation:
Review feedback: prefer Collections.emptyMap(), Collections.emptySet(),
Collections.emptyList() over Map.of(), Set.of(), List.of() for empty
collections since they use well-known immutable singleton APIs.
Modification:
Revert empty collection conversions while keeping non-empty
Arrays.asList -> List.of and Collections.singletonList -> List.of
conversions.
Result:
Empty collections use the established Collections.empty* API.
* style: apply javafmt to fix code style check failures
Apply javafmt to 8 Java source files across csv, google-cloud-bigquery,
hdfs, pravega, reference, and xml modules that were failing code style
check.
* fix: restore missing java.util.Arrays import in HdfsWriterTest
The Arrays import was accidentally removed during the Arrays.asList
migration, but Arrays::stream is still used in the test.
---
amqp/src/test/java/docs/javadsl/AmqpDocsTest.java | 12 +++++------
.../amqp/javadsl/AmqpConnectorsTest.java | 18 +++++++---------
.../connectors/amqp/javadsl/AmqpFlowTest.java | 9 ++++----
.../test/java/docs/javadsl/CassandraFlowTest.java | 7 +++---
.../java/docs/javadsl/CassandraSourceTest.java | 3 +--
.../java/docs/javadsl/CouchbaseExamplesTest.java | 3 +--
.../stream/connectors/csv/javadsl/CsvToMap.java | 10 +++------
.../test/java/docs/javadsl/CsvFormattingTest.java | 4 ++--
.../eip/javadsl/PassThroughExamples.java | 9 ++++----
.../javadsl/ElasticsearchParameterizedTest.java | 3 +--
.../java/docs/javadsl/ElasticsearchV5Test.java | 20 ++++++++---------
.../java/docs/javadsl/ElasticsearchV7Test.java | 20 ++++++++---------
.../docs/javadsl/OpensearchParameterizedTest.java | 3 +--
.../test/java/docs/javadsl/OpensearchV1Test.java | 20 ++++++++---------
file/src/test/java/docs/javadsl/ArchiveTest.java | 8 +++----
file/src/test/java/docs/javadsl/DirectoryTest.java | 9 ++++----
.../test/java/docs/javadsl/LogRotatorSinkTest.java | 10 ++++-----
.../java/docs/javadsl/NestedTarReaderTest.java | 5 ++---
.../test/java/docs/javadsl/GeodeBaseTestCase.java | 6 +++---
.../javadsl/GeodeContinuousSourceTestCase.java | 3 +--
.../src/test/java/docs/javadsl/BigQueryDoc.java | 2 +-
.../pubsub/grpc/AutoExtendAckDeadlinesTest.java | 9 ++++----
.../src/test/java/docs/javadsl/GCStorageTest.java | 17 +++++++--------
.../src/test/java/docs/javadsl/HBaseStageTest.java | 25 +++++++++++-----------
.../src/test/java/docs/javadsl/HdfsWriterTest.java | 16 ++++++--------
.../src/test/java/docs/javadsl/InfluxDbTest.java | 8 +++----
.../src/test/java/docs/javadsl/IronMqDocsTest.java | 3 +--
.../docs/javadsl/JmsBufferedAckConnectorsTest.java | 7 +++---
.../test/java/docs/javadsl/JmsConnectorsTest.java | 24 ++++++++++-----------
.../java/docs/javadsl/JmsIbmmqConnectorsTest.java | 7 +++---
.../java/docs/javadsl/JmsTxConnectorsTest.java | 7 +++---
.../jakartams/javadsl/JmsAckConnectorsTest.java | 6 +++---
.../docs/javadsl/JmsBufferedAckConnectorsTest.java | 6 +++---
.../test/java/docs/javadsl/JmsConnectorsTest.java | 24 ++++++++++-----------
.../java/docs/javadsl/JmsIbmmqConnectorsTest.java | 7 +++---
.../java/docs/javadsl/JmsTxConnectorsTest.java | 6 +++---
.../jms/javadsl/JmsAckConnectorsTest.java | 6 +++---
.../test/java/docs/javadsl/KinesisSnippets.java | 3 +--
kudu/src/test/java/docs/javadsl/KuduTableTest.java | 10 ++++-----
.../src/test/java/docs/javadsl/MqttSourceTest.java | 5 ++---
.../src/test/java/docs/javadsl/MqttSourceTest.java | 7 +++---
.../src/test/java/docs/javadsl/OrientDbTest.java | 11 +++++-----
.../java/docs/javadsl/PravegaReadWriteDocs.java | 5 ++---
.../connectors/pravega/PravegaGraphTestCase.java | 4 +---
.../connectors/pravega/PravegaKVTableTestCase.java | 7 +++---
.../src/test/java/docs/javadsl/ReferenceTest.java | 20 ++++++++---------
solr/src/test/java/docs/javadsl/SolrTest.java | 23 ++++++++++----------
sqs/src/test/java/docs/javadsl/SqsSourceTest.java | 3 +--
.../java/docs/javadsl/CharsetCodingFlowsDoc.java | 3 +--
xml/src/test/java/docs/javadsl/XmlParsingTest.java | 5 ++---
xml/src/test/java/docs/javadsl/XmlWritingTest.java | 2 +-
51 files changed, 214 insertions(+), 256 deletions(-)
diff --git a/amqp/src/test/java/docs/javadsl/AmqpDocsTest.java
b/amqp/src/test/java/docs/javadsl/AmqpDocsTest.java
index 06bb08309..7ec03844c 100644
--- a/amqp/src/test/java/docs/javadsl/AmqpDocsTest.java
+++ b/amqp/src/test/java/docs/javadsl/AmqpDocsTest.java
@@ -83,7 +83,7 @@ public class AmqpDocsTest {
AmqpDetailsConnectionProvider connectionProvider =
AmqpDetailsConnectionProvider.create("invalid", 5673)
.withHostsAndPorts(
- Arrays.asList(Pair.create("localhost", 5672),
Pair.create("localhost", 5674)));
+ List.of(Pair.create("localhost", 5672),
Pair.create("localhost", 5674)));
// #create-sink
final Sink<ByteString, CompletionStage<Done>> amqpSink =
@@ -92,7 +92,7 @@ public class AmqpDocsTest {
.withRoutingKey(queueName)
.withDeclaration(queueDeclaration));
- final List<String> input = Arrays.asList("one", "two", "three", "four",
"five");
+ final List<String> input = List.of("one", "two", "three", "four", "five");
CompletionStage<Done> writing =
Source.from(input).map(ByteString::fromString).runWith(amqpSink,
system);
// #create-sink
@@ -131,7 +131,7 @@ public class AmqpDocsTest {
.withDeclaration(queueDeclaration),
bufferSize);
- final List<String> input = Arrays.asList("one", "two", "three", "four",
"five");
+ final List<String> input = List.of("one", "two", "three", "four", "five");
// #create-rpc-flow
final Flow<ByteString, ByteString, CompletionStage<String>> ampqRpcFlow =
@@ -262,7 +262,7 @@ public class AmqpDocsTest {
.withRoutingKey(queueName)
.withDeclaration(queueDeclaration));
- final List<String> input = Arrays.asList("one", "two", "three", "four",
"five");
+ final List<String> input = List.of("one", "two", "three", "four", "five");
Source.from(input).map(ByteString::fromString).runWith(amqpSink, system);
// #create-source-withoutautoack
@@ -299,7 +299,7 @@ public class AmqpDocsTest {
.withRoutingKey(queueName)
.withDeclaration(queueDeclaration));
- final List<String> input = Arrays.asList("one", "two", "three", "four",
"five");
+ final List<String> input = List.of("one", "two", "three", "four", "five");
Source.from(input)
.map(ByteString::fromString)
.runWith(amqpSink, system)
@@ -362,7 +362,7 @@ public class AmqpDocsTest {
final Flow<WriteMessage, WriteResult, CompletionStage<Done>> amqpFlow =
AmqpFlow.createWithConfirm(settings);
- final List<String> input = Arrays.asList("one", "two", "three", "four",
"five");
+ final List<String> input = List.of("one", "two", "three", "four", "five");
final List<WriteResult> result =
Source.from(input)
diff --git
a/amqp/src/test/java/org/apache/pekko/stream/connectors/amqp/javadsl/AmqpConnectorsTest.java
b/amqp/src/test/java/org/apache/pekko/stream/connectors/amqp/javadsl/AmqpConnectorsTest.java
index e48526867..dc284e7b1 100644
---
a/amqp/src/test/java/org/apache/pekko/stream/connectors/amqp/javadsl/AmqpConnectorsTest.java
+++
b/amqp/src/test/java/org/apache/pekko/stream/connectors/amqp/javadsl/AmqpConnectorsTest.java
@@ -37,8 +37,6 @@ import scala.collection.JavaConverters;
import scala.concurrent.duration.Duration;
import java.net.ConnectException;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
@@ -87,7 +85,7 @@ public class AmqpConnectorsTest {
.withRoutingKey(queueName)
.withDeclaration(queueDeclaration));
- final List<String> input = Arrays.asList("one", "two", "three", "four",
"five");
+ final List<String> input = List.of("one", "two", "three", "four", "five");
final CompletionStage<Done> result =
Source.from(input).map(ByteString::fromString).runWith(amqpSink,
system);
@@ -106,7 +104,7 @@ public class AmqpConnectorsTest {
@SuppressWarnings("unchecked")
AmqpDetailsConnectionProvider connectionProvider =
AmqpDetailsConnectionProvider.create("invalid", 5673)
-
.withHostsAndPorts(Collections.singletonList(Pair.create("localhost", 5672)))
+ .withHostsAndPorts(List.of(Pair.create("localhost", 5672)))
.withCredentials(AmqpCredentials.create("guest", "guest1"));
final Sink<ByteString, CompletionStage<Done>> amqpSink =
@@ -115,7 +113,7 @@ public class AmqpConnectorsTest {
.withRoutingKey(queueName)
.withDeclaration(queueDeclaration));
- final List<String> input = Arrays.asList("one", "two", "three", "four",
"five");
+ final List<String> input = List.of("one", "two", "three", "four", "five");
final CompletionStage<Done> result =
Source.from(input).map(ByteString::fromString).runWith(amqpSink,
system);
@@ -134,7 +132,7 @@ public class AmqpConnectorsTest {
final String queueName = "amqp-conn-it-spec-rpc-queue-" +
System.currentTimeMillis();
final QueueDeclaration queueDeclaration =
QueueDeclaration.create(queueName);
- final List<String> input = Arrays.asList("one", "two", "three", "four",
"five");
+ final List<String> input = List.of("one", "two", "three", "four", "five");
final Flow<WriteMessage, CommittableReadResult, CompletionStage<String>>
ampqRpcFlow =
AmqpRpcFlow.committableFlow(
@@ -197,7 +195,7 @@ public class AmqpConnectorsTest {
.withDeclaration(queueDeclaration),
bufferSize);
- final List<String> input = Arrays.asList("one", "two", "three", "four",
"five");
+ final List<String> input = List.of("one", "two", "three", "four", "five");
Source.from(input)
.map(ByteString::fromString)
.runWith(amqpSink, system)
@@ -236,17 +234,17 @@ public class AmqpConnectorsTest {
AmqpWriteSettings.create(connectionProvider)
.withExchange(exchangeName)
.withDeclarations(
- Arrays.asList(exchangeDeclaration, queueDeclaration,
bindingDeclaration)));
+ List.of(exchangeDeclaration, queueDeclaration,
bindingDeclaration)));
final Integer bufferSize = 10;
final Source<ReadResult, NotUsed> amqpSource =
AmqpSource.atMostOnceSource(
NamedQueueSourceSettings.create(connectionProvider, queueName)
.withDeclarations(
- Arrays.asList(exchangeDeclaration, queueDeclaration,
bindingDeclaration)),
+ List.of(exchangeDeclaration, queueDeclaration,
bindingDeclaration)),
bufferSize);
- final List<String> input = Arrays.asList("one", "two", "three", "four",
"five");
+ final List<String> input = List.of("one", "two", "three", "four", "five");
final List<String> routingKeys =
input.stream().map(s -> "key." + s).collect(Collectors.toList());
Source.from(input)
diff --git
a/amqp/src/test/java/org/apache/pekko/stream/connectors/amqp/javadsl/AmqpFlowTest.java
b/amqp/src/test/java/org/apache/pekko/stream/connectors/amqp/javadsl/AmqpFlowTest.java
index 511377ea8..61e0c8f4e 100644
---
a/amqp/src/test/java/org/apache/pekko/stream/connectors/amqp/javadsl/AmqpFlowTest.java
+++
b/amqp/src/test/java/org/apache/pekko/stream/connectors/amqp/javadsl/AmqpFlowTest.java
@@ -14,7 +14,6 @@
package org.apache.pekko.stream.connectors.amqp.javadsl;
import java.time.Duration;
-import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletionStage;
import java.util.stream.Collectors;
@@ -52,7 +51,7 @@ public class AmqpFlowTest {
@Parameters
public static Iterable<? extends Object> data() {
- return Arrays.asList(false, true);
+ return List.of(false, true);
}
/** This value is initialized with values from data() array */
@@ -97,7 +96,7 @@ public class AmqpFlowTest {
private void shouldEmitConfirmationForPublishedMessages(
final Flow<WriteMessage, WriteResult, CompletionStage<Done>> flow) {
- final List<String> input = Arrays.asList("one", "two", "three", "four",
"five");
+ final List<String> input = List.of("one", "two", "three", "four", "five");
final List<WriteResult> expectedOutput =
input.stream().map(pt ->
WriteResult.create(true)).collect(Collectors.toList());
@@ -127,7 +126,7 @@ public class AmqpFlowTest {
FlowWithContext<WriteMessage, String, WriteResult, String,
CompletionStage<Done>>
flowWithContext) {
- final List<String> input = Arrays.asList("one", "two", "three", "four",
"five");
+ final List<String> input = List.of("one", "two", "three", "four", "five");
final List<Pair<WriteResult, String>> expectedOutput =
input.stream()
.map(pt -> Pair.create(WriteResult.create(true), pt))
@@ -152,7 +151,7 @@ public class AmqpFlowTest {
Flow<Pair<WriteMessage, String>, Pair<WriteResult, String>,
CompletionStage<Done>> flow =
AmqpFlow.createWithConfirmAndPassThroughUnordered(settings());
- final List<String> input = Arrays.asList("one", "two", "three", "four",
"five");
+ final List<String> input = List.of("one", "two", "three", "four", "five");
final List<Pair<WriteResult, String>> expectedOutput =
input.stream()
.map(pt -> Pair.create(WriteResult.create(true), pt))
diff --git a/cassandra/src/test/java/docs/javadsl/CassandraFlowTest.java
b/cassandra/src/test/java/docs/javadsl/CassandraFlowTest.java
index 2a5ce0c85..44b0c15bb 100644
--- a/cassandra/src/test/java/docs/javadsl/CassandraFlowTest.java
+++ b/cassandra/src/test/java/docs/javadsl/CassandraFlowTest.java
@@ -37,7 +37,6 @@ import org.junit.Rule;
import org.junit.Test;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.concurrent.*;
@@ -76,7 +75,7 @@ public class CassandraFlowTest {
cassandraAccess
.lifecycleSession()
.executeDDL("CREATE TABLE IF NOT EXISTS " + table + " (id
int PRIMARY KEY);")));
- List<Integer> data = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8);
+ List<Integer> data = List.of(1, 2, 3, 4, 5, 6, 7, 8);
CompletionStage<Done> written =
Source.from(data)
@@ -114,7 +113,7 @@ public class CassandraFlowTest {
// #prepared
List<Person> persons =
- Arrays.asList(
+ List.of(
new Person(12, "John", "London"),
new Person(43, "Umberto", "Roma"),
new Person(56, "James", "Chicago"));
@@ -157,7 +156,7 @@ public class CassandraFlowTest {
+ " (id int PRIMARY KEY, name text, city
text);")));
List<Pair<Person, AckHandle>> persons =
- Arrays.asList(
+ List.of(
Pair.create(new Person(12, "John", "London"), new AckHandle()),
Pair.create(new Person(43, "Umberto", "Roma"), new AckHandle()),
Pair.create(new Person(56, "James", "Chicago"), new AckHandle()));
diff --git a/cassandra/src/test/java/docs/javadsl/CassandraSourceTest.java
b/cassandra/src/test/java/docs/javadsl/CassandraSourceTest.java
index 7e5a33acd..4bdf6f229 100644
--- a/cassandra/src/test/java/docs/javadsl/CassandraSourceTest.java
+++ b/cassandra/src/test/java/docs/javadsl/CassandraSourceTest.java
@@ -36,7 +36,6 @@ import org.junit.Rule;
import org.junit.Test;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
@@ -53,7 +52,7 @@ public class CassandraSourceTest {
static CassandraTestHelper helper;
static String idtable;
- static final List<Integer> data = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8);
+ static final List<Integer> data = List.of(1, 2, 3, 4, 5, 6, 7, 8);
@Rule public final LogCapturingJunit4 logCapturing = new
LogCapturingJunit4();
diff --git a/couchbase/src/test/java/docs/javadsl/CouchbaseExamplesTest.java
b/couchbase/src/test/java/docs/javadsl/CouchbaseExamplesTest.java
index aae79297d..b82360030 100644
--- a/couchbase/src/test/java/docs/javadsl/CouchbaseExamplesTest.java
+++ b/couchbase/src/test/java/docs/javadsl/CouchbaseExamplesTest.java
@@ -53,7 +53,6 @@ import org.junit.*;
import java.time.Duration;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.*;
@@ -237,7 +236,7 @@ public class CouchbaseExamplesTest {
public void fromId() throws Exception {
support.upsertSampleData(queryBucketName);
// #fromId
- List<String> ids = Arrays.asList("First", "Second", "Third", "Fourth");
+ List<String> ids = List.of("First", "Second", "Third", "Fourth");
CompletionStage<List<JsonDocument>> result =
Source.from(ids)
diff --git
a/csv/src/main/java/org/apache/pekko/stream/connectors/csv/javadsl/CsvToMap.java
b/csv/src/main/java/org/apache/pekko/stream/connectors/csv/javadsl/CsvToMap.java
index 505f512a0..7fb5821d0 100644
---
a/csv/src/main/java/org/apache/pekko/stream/connectors/csv/javadsl/CsvToMap.java
+++
b/csv/src/main/java/org/apache/pekko/stream/connectors/csv/javadsl/CsvToMap.java
@@ -20,8 +20,8 @@ import org.apache.pekko.util.ByteString;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
import java.util.Collection;
+import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -109,7 +109,7 @@ public class CsvToMap {
String... headers) {
return Flow.fromGraph(
new CsvToMapJavaStage(
- Optional.of(Arrays.asList(headers)),
+ Optional.of(List.of(headers)),
StandardCharsets.UTF_8,
false,
Optional.empty(),
@@ -126,10 +126,6 @@ public class CsvToMap {
Charset charset, String... headers) {
return Flow.fromGraph(
new CsvToMapAsStringsJavaStage(
- Optional.of(Arrays.asList(headers)),
- charset,
- false,
- Optional.empty(),
- Optional.empty()));
+ Optional.of(List.of(headers)), charset, false, Optional.empty(),
Optional.empty()));
}
}
diff --git a/csv/src/test/java/docs/javadsl/CsvFormattingTest.java
b/csv/src/test/java/docs/javadsl/CsvFormattingTest.java
index 32edd21b9..f302794cc 100644
--- a/csv/src/test/java/docs/javadsl/CsvFormattingTest.java
+++ b/csv/src/test/java/docs/javadsl/CsvFormattingTest.java
@@ -31,8 +31,8 @@ import org.junit.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
import java.util.Collection;
+import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
@@ -74,7 +74,7 @@ public class CsvFormattingTest {
throws InterruptedException, ExecutionException, TimeoutException {
CompletionStage<ByteString> completionStage =
// #formatting
- Source.single(Arrays.asList("one", "two", "three"))
+ Source.single(List.of("one", "two", "three"))
.via(CsvFormatting.format())
.runWith(Sink.head(), system);
// #formatting
diff --git
a/doc-examples/src/test/java/org/apache/pekko/stream/connectors/eip/javadsl/PassThroughExamples.java
b/doc-examples/src/test/java/org/apache/pekko/stream/connectors/eip/javadsl/PassThroughExamples.java
index 54fae8b34..685adc93d 100644
---
a/doc-examples/src/test/java/org/apache/pekko/stream/connectors/eip/javadsl/PassThroughExamples.java
+++
b/doc-examples/src/test/java/org/apache/pekko/stream/connectors/eip/javadsl/PassThroughExamples.java
@@ -33,7 +33,6 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
@@ -45,7 +44,7 @@ public class PassThroughExamples {
public void passThroughWithKeep() throws InterruptedException,
ExecutionException {
// #PassThroughWithKeep
// Sample Source
- Source<Integer, NotUsed> source = Source.from(Arrays.asList(1, 2, 3));
+ Source<Integer, NotUsed> source = Source.from(List.of(1, 2, 3));
// Pass through this flow maintaining the original message
Flow<Integer, Integer, NotUsed> passThroughMe =
Flow.of(Integer.class).map(i -> i * 10);
@@ -55,7 +54,7 @@ public class PassThroughExamples {
// Verify results
List<Integer> list = ret.toCompletableFuture().get();
- assert list.equals(Arrays.asList(1, 2, 3));
+ assert list.equals(List.of(1, 2, 3));
// #PassThroughWithKeep
}
@@ -63,7 +62,7 @@ public class PassThroughExamples {
public void passThroughTuple() throws InterruptedException,
ExecutionException {
// #PassThroughTuple
// Sample Source
- Source<Integer, NotUsed> source = Source.from(Arrays.asList(1, 2, 3));
+ Source<Integer, NotUsed> source = Source.from(List.of(1, 2, 3));
// Pass through this flow maintaining the original message
Flow<Integer, Integer, NotUsed> passThroughMe =
Flow.of(Integer.class).map(i -> i * 10);
@@ -74,7 +73,7 @@ public class PassThroughExamples {
// Verify results
List<Pair<Integer, Integer>> list = ret.toCompletableFuture().get();
assert list.equals(
- Arrays.asList(
+ List.of(
new Pair<Integer, Integer>(10, 1),
new Pair<Integer, Integer>(20, 2),
new Pair<Integer, Integer>(30, 3)));
diff --git
a/elasticsearch/src/test/java/docs/javadsl/ElasticsearchParameterizedTest.java
b/elasticsearch/src/test/java/docs/javadsl/ElasticsearchParameterizedTest.java
index 60a1ffda4..76f78ba06 100644
---
a/elasticsearch/src/test/java/docs/javadsl/ElasticsearchParameterizedTest.java
+++
b/elasticsearch/src/test/java/docs/javadsl/ElasticsearchParameterizedTest.java
@@ -26,7 +26,6 @@ import org.junit.runners.Parameterized;
import java.io.IOException;
import java.time.Duration;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -40,7 +39,7 @@ public class ElasticsearchParameterizedTest extends
ElasticsearchTestBase {
@Parameterized.Parameters(name = "{index}: port={0} api={1}")
public static Iterable<Object[]> data() {
- return Arrays.asList(
+ return List.of(
new Object[][] {
{9201, ApiVersion.V5},
{9202, ApiVersion.V7}
diff --git a/elasticsearch/src/test/java/docs/javadsl/ElasticsearchV5Test.java
b/elasticsearch/src/test/java/docs/javadsl/ElasticsearchV5Test.java
index d719bb3d7..a221a7245 100644
--- a/elasticsearch/src/test/java/docs/javadsl/ElasticsearchV5Test.java
+++ b/elasticsearch/src/test/java/docs/javadsl/ElasticsearchV5Test.java
@@ -93,7 +93,7 @@ public class ElasticsearchV5Test extends
ElasticsearchTestBase {
List<String> result = new ArrayList<>(f2.toCompletableFuture().get());
List<String> expect =
- Arrays.asList(
+ List.of(
"Akka Concurrency",
"Akka in Action",
"Effective Akka",
@@ -149,7 +149,7 @@ public class ElasticsearchV5Test extends
ElasticsearchTestBase {
List<String> result = new ArrayList<>(f2.toCompletableFuture().get());
List<String> expect =
- Arrays.asList(
+ List.of(
"Akka Concurrency",
"Akka in Action",
"Effective Akka",
@@ -208,7 +208,7 @@ public class ElasticsearchV5Test extends
ElasticsearchTestBase {
List<String> result2 = new ArrayList<>(f2.toCompletableFuture().get());
List<String> expect =
- Arrays.asList(
+ List.of(
"Akka Concurrency",
"Akka in Action",
"Effective Akka",
@@ -228,7 +228,7 @@ public class ElasticsearchV5Test extends
ElasticsearchTestBase {
String indexName = "sink3-0";
CompletionStage<List<WriteResult<String, NotUsed>>> write =
Source.from(
- Arrays.asList(
+ List.of(
WriteMessage.createIndexMessage("1", "{\"title\": \"Das
Parfum\"}"),
WriteMessage.createIndexMessage("2", "{\"title\":
\"Faust\"}"),
WriteMessage.createIndexMessage(
@@ -263,7 +263,7 @@ public class ElasticsearchV5Test extends
ElasticsearchTestBase {
List<String> result2 = new ArrayList<>(f2.toCompletableFuture().get());
- List<String> expect = Arrays.asList("Das Parfum", "Die unendliche
Geschichte", "Faust");
+ List<String> expect = List.of("Das Parfum", "Die unendliche Geschichte",
"Faust");
Collections.sort(result2);
assertEquals(expect, result2);
@@ -274,7 +274,7 @@ public class ElasticsearchV5Test extends
ElasticsearchTestBase {
// #multiple-operations
// Create, update, upsert and delete documents in sink8/book
List<WriteMessage<Book, NotUsed>> requests =
- Arrays.asList(
+ List.of(
WriteMessage.createIndexMessage("00001", new Book("Book 1")),
WriteMessage.createUpsertMessage("00002", new Book("Book 2")),
WriteMessage.createUpsertMessage("00003", new Book("Book 3")),
@@ -306,7 +306,7 @@ public class ElasticsearchV5Test extends
ElasticsearchTestBase {
.runWith(Sink.seq(), system);
List<String> result2 = new ArrayList<>(f2.toCompletableFuture().get());
- List<String> expect = Arrays.asList("Book 1", "Book 3");
+ List<String> expect = List.of("Book 1", "Book 3");
Collections.sort(result2);
assertEquals(expect, result2);
@@ -320,7 +320,7 @@ public class ElasticsearchV5Test extends
ElasticsearchTestBase {
// to commit the offset to Kafka
List<KafkaMessage> messagesFromKafka =
- Arrays.asList(
+ List.of(
new KafkaMessage(new Book("Book 1"), new KafkaOffset(0)),
new KafkaMessage(new Book("Book 2"), new KafkaOffset(1)),
new KafkaMessage(new Book("Book 3"), new KafkaOffset(2)));
@@ -359,7 +359,7 @@ public class ElasticsearchV5Test extends
ElasticsearchTestBase {
flushAndRefresh("sink6");
// Make sure all messages was committed to kafka
- assertEquals(Arrays.asList(0, 1, 2), kafkaCommitter.committedOffsets);
+ assertEquals(List.of(0, 1, 2), kafkaCommitter.committedOffsets);
// Assert that all docs were written to elastic
List<String> result2 =
@@ -386,7 +386,7 @@ public class ElasticsearchV5Test extends
ElasticsearchTestBase {
String typeName = "_doc";
List<TestDoc> docs =
- Arrays.asList(
+ List.of(
new TestDoc("1", "a1", "b1", "c1"),
new TestDoc("2", "a2", "b2", "c2"),
new TestDoc("3", "a3", "b3", "c3"));
diff --git a/elasticsearch/src/test/java/docs/javadsl/ElasticsearchV7Test.java
b/elasticsearch/src/test/java/docs/javadsl/ElasticsearchV7Test.java
index e27abda24..85862a2eb 100644
--- a/elasticsearch/src/test/java/docs/javadsl/ElasticsearchV7Test.java
+++ b/elasticsearch/src/test/java/docs/javadsl/ElasticsearchV7Test.java
@@ -90,7 +90,7 @@ public class ElasticsearchV7Test extends
ElasticsearchTestBase {
List<String> result = new ArrayList<>(f2.toCompletableFuture().get());
List<String> expect =
- Arrays.asList(
+ List.of(
"Akka Concurrency",
"Akka in Action",
"Effective Akka",
@@ -146,7 +146,7 @@ public class ElasticsearchV7Test extends
ElasticsearchTestBase {
List<String> result = new ArrayList<>(f2.toCompletableFuture().get());
List<String> expect =
- Arrays.asList(
+ List.of(
"Akka Concurrency",
"Akka in Action",
"Effective Akka",
@@ -203,7 +203,7 @@ public class ElasticsearchV7Test extends
ElasticsearchTestBase {
List<String> result2 = new ArrayList<>(f2.toCompletableFuture().get());
List<String> expect =
- Arrays.asList(
+ List.of(
"Akka Concurrency",
"Akka in Action",
"Effective Akka",
@@ -222,7 +222,7 @@ public class ElasticsearchV7Test extends
ElasticsearchTestBase {
String indexName = "sink3-0";
CompletionStage<List<WriteResult<String, NotUsed>>> write =
Source.from(
- Arrays.asList(
+ List.of(
WriteMessage.createIndexMessage("1", "{\"title\": \"Das
Parfum\"}"),
WriteMessage.createIndexMessage("2", "{\"title\":
\"Faust\"}"),
WriteMessage.createIndexMessage(
@@ -256,7 +256,7 @@ public class ElasticsearchV7Test extends
ElasticsearchTestBase {
List<String> result2 = new ArrayList<>(f2.toCompletableFuture().get());
- List<String> expect = Arrays.asList("Das Parfum", "Die unendliche
Geschichte", "Faust");
+ List<String> expect = List.of("Das Parfum", "Die unendliche Geschichte",
"Faust");
Collections.sort(result2);
assertEquals(expect, result2);
@@ -266,7 +266,7 @@ public class ElasticsearchV7Test extends
ElasticsearchTestBase {
public void testMultipleOperations() throws Exception {
// Create, update, upsert and delete documents in sink8/book
List<WriteMessage<Book, NotUsed>> requests =
- Arrays.asList(
+ List.of(
WriteMessage.createIndexMessage("00001", new Book("Book 1")),
WriteMessage.createUpsertMessage("00002", new Book("Book 2")),
WriteMessage.createUpsertMessage("00003", new Book("Book 3")),
@@ -297,7 +297,7 @@ public class ElasticsearchV7Test extends
ElasticsearchTestBase {
.runWith(Sink.seq(), system);
List<String> result2 = new ArrayList<>(f2.toCompletableFuture().get());
- List<String> expect = Arrays.asList("Book 1", "Book 3");
+ List<String> expect = List.of("Book 1", "Book 3");
Collections.sort(result2);
assertEquals(expect, result2);
@@ -310,7 +310,7 @@ public class ElasticsearchV7Test extends
ElasticsearchTestBase {
// to commit the offset to Kafka
List<KafkaMessage> messagesFromKafka =
- Arrays.asList(
+ List.of(
new KafkaMessage(new Book("Book 1"), new KafkaOffset(0)),
new KafkaMessage(new Book("Book 2"), new KafkaOffset(1)),
new KafkaMessage(new Book("Book 3"), new KafkaOffset(2)));
@@ -349,7 +349,7 @@ public class ElasticsearchV7Test extends
ElasticsearchTestBase {
flushAndRefresh("sink6");
// Make sure all messages was committed to kafka
- assertEquals(Arrays.asList(0, 1, 2), kafkaCommitter.committedOffsets);
+ assertEquals(List.of(0, 1, 2), kafkaCommitter.committedOffsets);
// Assert that all docs were written to elastic
List<String> result2 =
@@ -376,7 +376,7 @@ public class ElasticsearchV7Test extends
ElasticsearchTestBase {
String typeName = "_doc";
List<TestDoc> docs =
- Arrays.asList(
+ List.of(
new TestDoc("1", "a1", "b1", "c1"),
new TestDoc("2", "a2", "b2", "c2"),
new TestDoc("3", "a3", "b3", "c3"));
diff --git
a/elasticsearch/src/test/java/docs/javadsl/OpensearchParameterizedTest.java
b/elasticsearch/src/test/java/docs/javadsl/OpensearchParameterizedTest.java
index 9eac31305..cfc46b24d 100644
--- a/elasticsearch/src/test/java/docs/javadsl/OpensearchParameterizedTest.java
+++ b/elasticsearch/src/test/java/docs/javadsl/OpensearchParameterizedTest.java
@@ -26,7 +26,6 @@ import org.junit.runners.Parameterized;
import java.io.IOException;
import java.time.Duration;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -40,7 +39,7 @@ public class OpensearchParameterizedTest extends
ElasticsearchTestBase {
@Parameterized.Parameters(name = "{index}: port={0} api={1}")
public static Iterable<Object[]> data() {
- return Arrays.asList(new Object[][] {{9203, OpensearchApiVersion.V1}});
+ return List.of(new Object[][] {{9203, OpensearchApiVersion.V1}});
}
public OpensearchParameterizedTest(int port, OpensearchApiVersion
apiVersion) {
diff --git a/elasticsearch/src/test/java/docs/javadsl/OpensearchV1Test.java
b/elasticsearch/src/test/java/docs/javadsl/OpensearchV1Test.java
index e6cfb6c34..caab09441 100644
--- a/elasticsearch/src/test/java/docs/javadsl/OpensearchV1Test.java
+++ b/elasticsearch/src/test/java/docs/javadsl/OpensearchV1Test.java
@@ -92,7 +92,7 @@ public class OpensearchV1Test extends ElasticsearchTestBase {
List<String> result = new ArrayList<>(f2.toCompletableFuture().get());
List<String> expect =
- Arrays.asList(
+ List.of(
"Akka Concurrency",
"Akka in Action",
"Effective Akka",
@@ -148,7 +148,7 @@ public class OpensearchV1Test extends ElasticsearchTestBase
{
List<String> result = new ArrayList<>(f2.toCompletableFuture().get());
List<String> expect =
- Arrays.asList(
+ List.of(
"Akka Concurrency",
"Akka in Action",
"Effective Akka",
@@ -207,7 +207,7 @@ public class OpensearchV1Test extends ElasticsearchTestBase
{
List<String> result2 = new ArrayList<>(f2.toCompletableFuture().get());
List<String> expect =
- Arrays.asList(
+ List.of(
"Akka Concurrency",
"Akka in Action",
"Effective Akka",
@@ -227,7 +227,7 @@ public class OpensearchV1Test extends ElasticsearchTestBase
{
// #string
CompletionStage<List<WriteResult<String, NotUsed>>> write =
Source.from(
- Arrays.asList(
+ List.of(
WriteMessage.createIndexMessage("1", "{\"title\": \"Das
Parfum\"}"),
WriteMessage.createIndexMessage("2", "{\"title\":
\"Faust\"}"),
WriteMessage.createIndexMessage(
@@ -262,7 +262,7 @@ public class OpensearchV1Test extends ElasticsearchTestBase
{
List<String> result2 = new ArrayList<>(f2.toCompletableFuture().get());
- List<String> expect = Arrays.asList("Das Parfum", "Die unendliche
Geschichte", "Faust");
+ List<String> expect = List.of("Das Parfum", "Die unendliche Geschichte",
"Faust");
Collections.sort(result2);
assertEquals(expect, result2);
@@ -273,7 +273,7 @@ public class OpensearchV1Test extends ElasticsearchTestBase
{
// #multiple-operations
// Create, update, upsert and delete documents in sink8/book
List<WriteMessage<Book, NotUsed>> requests =
- Arrays.asList(
+ List.of(
WriteMessage.createIndexMessage("00001", new Book("Book 1")),
WriteMessage.createUpsertMessage("00002", new Book("Book 2")),
WriteMessage.createUpsertMessage("00003", new Book("Book 3")),
@@ -306,7 +306,7 @@ public class OpensearchV1Test extends ElasticsearchTestBase
{
.runWith(Sink.seq(), system);
List<String> result2 = new ArrayList<>(f2.toCompletableFuture().get());
- List<String> expect = Arrays.asList("Book 1", "Book 3");
+ List<String> expect = List.of("Book 1", "Book 3");
Collections.sort(result2);
assertEquals(expect, result2);
@@ -320,7 +320,7 @@ public class OpensearchV1Test extends ElasticsearchTestBase
{
// to commit the offset to Kafka
List<KafkaMessage> messagesFromKafka =
- Arrays.asList(
+ List.of(
new KafkaMessage(new Book("Book 1"), new KafkaOffset(0)),
new KafkaMessage(new Book("Book 2"), new KafkaOffset(1)),
new KafkaMessage(new Book("Book 3"), new KafkaOffset(2)));
@@ -359,7 +359,7 @@ public class OpensearchV1Test extends ElasticsearchTestBase
{
flushAndRefresh("sink6");
// Make sure all messages was committed to kafka
- assertEquals(Arrays.asList(0, 1, 2), kafkaCommitter.committedOffsets);
+ assertEquals(List.of(0, 1, 2), kafkaCommitter.committedOffsets);
// Assert that all docs were written to elastic
List<String> result2 =
@@ -386,7 +386,7 @@ public class OpensearchV1Test extends ElasticsearchTestBase
{
String typeName = "_doc";
List<TestDoc> docs =
- Arrays.asList(
+ List.of(
new TestDoc("1", "a1", "b1", "c1"),
new TestDoc("2", "a2", "b2", "c2"),
new TestDoc("3", "a3", "b3", "c3"));
diff --git a/file/src/test/java/docs/javadsl/ArchiveTest.java
b/file/src/test/java/docs/javadsl/ArchiveTest.java
index 65058aee6..063e19d26 100644
--- a/file/src/test/java/docs/javadsl/ArchiveTest.java
+++ b/file/src/test/java/docs/javadsl/ArchiveTest.java
@@ -41,8 +41,8 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Instant;
-import java.util.Arrays;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
@@ -95,7 +95,7 @@ public class ArchiveTest {
Pair.create(ArchiveMetadata.create("foundation.svg"), source2);
Source<Pair<ArchiveMetadata, Source<ByteString, NotUsed>>, NotUsed> source
=
- Source.from(Arrays.asList(pair1, pair2));
+ Source.from(List.of(pair1, pair2));
Sink<ByteString, CompletionStage<IOResult>> fileSink =
FileIO.toPath(Paths.get("logo.zip"));
CompletionStage<IOResult> ioResult =
source.via(Archive.zip()).runWith(fileSink, system);
@@ -173,7 +173,7 @@ public class ArchiveTest {
Pair.create(TarArchiveMetadata.create("foundation.svg", size2,
lastModification), source2);
Source<Pair<TarArchiveMetadata, Source<ByteString, NotUsed>>, NotUsed>
source =
- Source.from(Arrays.asList(dir, pair1, pair2));
+ Source.from(List.of(dir, pair1, pair2));
Sink<ByteString, CompletionStage<IOResult>> fileSink =
FileIO.toPath(Paths.get("logo.tar"));
CompletionStage<IOResult> ioResult =
source.via(Archive.tar()).runWith(fileSink, system);
@@ -203,7 +203,7 @@ public class ArchiveTest {
TarArchiveMetadata metadata2 = TarArchiveMetadata.create("dir/file1.txt",
tenDigits.length());
CompletionStage<ByteString> oneFileArchive =
Source.from(
- Arrays.asList(
+ List.of(
Pair.create(metadata1, Source.empty(ByteString.class)),
Pair.create(metadata2, Source.single(tenDigits))))
.via(Archive.tar())
diff --git a/file/src/test/java/docs/javadsl/DirectoryTest.java
b/file/src/test/java/docs/javadsl/DirectoryTest.java
index a6158f6f8..607aa27d8 100644
--- a/file/src/test/java/docs/javadsl/DirectoryTest.java
+++ b/file/src/test/java/docs/javadsl/DirectoryTest.java
@@ -37,7 +37,6 @@ import org.junit.*;
import java.nio.file.FileSystem;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
@@ -106,7 +105,7 @@ public class DirectoryTest {
final List<Path> result =
source.runWith(Sink.seq(), system).toCompletableFuture().get(3,
TimeUnit.SECONDS);
- assertEquals(result, Arrays.asList(root, subdir1, file1, subdir2, file2));
+ assertEquals(result, List.of(root, subdir1, file1, subdir2, file2));
}
@Test
@@ -129,7 +128,7 @@ public class DirectoryTest {
final List<Path> result =
source.runWith(Sink.seq(), system).toCompletableFuture().get(3,
TimeUnit.SECONDS);
- assertEquals(result, Arrays.asList(root, subdir1, subdir2));
+ assertEquals(result, List.of(root, subdir1, subdir2));
}
@Test
@@ -141,7 +140,7 @@ public class DirectoryTest {
Flow<Path, Path, NotUsed> flow = Directory.mkdirs();
CompletionStage<List<Path>> created =
- Source.from(Arrays.asList(dir.resolve("dirA"), dir.resolve("dirB")))
+ Source.from(List.of(dir.resolve("dirA"), dir.resolve("dirB")))
.via(flow)
.runWith(Sink.seq(), system);
// #mkdirs
@@ -162,7 +161,7 @@ public class DirectoryTest {
Directory.mkdirsWithContext();
// #mkdirs
CompletionStage<List<Path>> created =
- Source.from(Arrays.asList(dir.resolve("dirA"), dir.resolve("dirB")))
+ Source.from(List.of(dir.resolve("dirA"), dir.resolve("dirB")))
.asSourceWithContext(ctx -> new SomeContext())
.via(flowWithContext)
.asSource()
diff --git a/file/src/test/java/docs/javadsl/LogRotatorSinkTest.java
b/file/src/test/java/docs/javadsl/LogRotatorSinkTest.java
index 804b75ce7..e19566ff9 100644
--- a/file/src/test/java/docs/javadsl/LogRotatorSinkTest.java
+++ b/file/src/test/java/docs/javadsl/LogRotatorSinkTest.java
@@ -32,7 +32,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
-import java.util.Arrays;
+import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
@@ -83,7 +83,7 @@ public class LogRotatorSinkTest {
LogRotatorSink.createFromFunction(sizeBasedTriggerCreator);
// #size
CompletionStage<Done> fileSizeCompletion =
- Source.from(Arrays.asList("test1", "test2", "test3", "test4", "test5",
"test6"))
+ Source.from(List.of("test1", "test2", "test3", "test4", "test5",
"test6"))
.map(ByteString::fromString)
.runWith(sizeRotatorSink, system);
@@ -116,7 +116,7 @@ public class LogRotatorSinkTest {
// #time
CompletionStage<Done> fileSizeCompletion =
- Source.from(Arrays.asList("test1", "test2", "test3", "test4", "test5",
"test6"))
+ Source.from(List.of("test1", "test2", "test3", "test4", "test5",
"test6"))
.map(ByteString::fromString)
.runWith(timeBasedSink, system);
@@ -134,11 +134,11 @@ public class LogRotatorSinkTest {
Creator<Function<ByteString, Optional<Path>>> triggerFunctionCreator =
timeBasedTriggerCreator;
Source<ByteString, NotUsed> source =
- Source.from(Arrays.asList("test1", "test2", "test3", "test4", "test5",
"test6"))
+ Source.from(List.of("test1", "test2", "test3", "test4", "test5",
"test6"))
.map(ByteString::fromString);
// #sample
CompletionStage<Done> completion =
- Source.from(Arrays.asList("test1", "test2", "test3", "test4", "test5",
"test6"))
+ Source.from(List.of("test1", "test2", "test3", "test4", "test5",
"test6"))
.map(ByteString::fromString)
.runWith(LogRotatorSink.createFromFunction(triggerFunctionCreator), system);
diff --git a/file/src/test/java/docs/javadsl/NestedTarReaderTest.java
b/file/src/test/java/docs/javadsl/NestedTarReaderTest.java
index 0e2e61f9f..546acd09d 100644
--- a/file/src/test/java/docs/javadsl/NestedTarReaderTest.java
+++ b/file/src/test/java/docs/javadsl/NestedTarReaderTest.java
@@ -35,7 +35,6 @@ import org.slf4j.LoggerFactory;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
@@ -98,7 +97,7 @@ public class NestedTarReaderTest {
.via(Directory.mkdirs())
.toMat(Sink.ignore(), Keep.right())
.run(system)
- .thenApply(d -> Collections.singletonList(metadata));
+ .thenApply(d -> List.of(metadata));
} else if
(targetFile.getFileName().toString().endsWith(TARGZ_EXT)) {
Path targetSubDir =
targetFile
@@ -119,7 +118,7 @@ public class NestedTarReaderTest {
source
.toMat(Sink.ignore(), Keep.right())
.run(system)
- .thenApply(d -> Collections.singletonList(metadata));
+ .thenApply(d -> List.of(metadata));
}
return readMetadata;
})
diff --git a/geode/src/test/java/docs/javadsl/GeodeBaseTestCase.java
b/geode/src/test/java/docs/javadsl/GeodeBaseTestCase.java
index f7658b28d..0f9ea188b 100644
--- a/geode/src/test/java/docs/javadsl/GeodeBaseTestCase.java
+++ b/geode/src/test/java/docs/javadsl/GeodeBaseTestCase.java
@@ -29,8 +29,8 @@ import org.junit.Rule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.Arrays;
import java.util.Date;
+import java.util.List;
public class GeodeBaseTestCase {
@Rule public final LogCapturingJunit4 logCapturing = new
LogCapturingJunit4();
@@ -59,12 +59,12 @@ public class GeodeBaseTestCase {
}
static Source<Person, NotUsed> buildPersonsSource(Integer... ids) {
- return Source.from(Arrays.asList(ids))
+ return Source.from(List.of(ids))
.map((i) -> new Person(i, String.format("Person Java %d", i), new
Date()));
}
static Source<Animal, NotUsed> buildAnimalsSource(Integer... ids) {
- return Source.from(Arrays.asList(ids))
+ return Source.from(List.of(ids))
.map((i) -> new Animal(i, String.format("Animal Java %d", i), 1));
}
diff --git
a/geode/src/test/java/docs/javadsl/GeodeContinuousSourceTestCase.java
b/geode/src/test/java/docs/javadsl/GeodeContinuousSourceTestCase.java
index d29980f00..3c6797924 100644
--- a/geode/src/test/java/docs/javadsl/GeodeContinuousSourceTestCase.java
+++ b/geode/src/test/java/docs/javadsl/GeodeContinuousSourceTestCase.java
@@ -25,7 +25,6 @@ import org.apache.pekko.stream.javadsl.Source;
import org.junit.Rule;
import org.junit.Test;
-import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.concurrent.CompletionStage;
@@ -57,7 +56,7 @@ public class GeodeContinuousSourceTestCase extends
GeodeBaseTestCase {
geode.flow(personRegionSettings, new PersonPdxSerializer());
Pair<NotUsed, CompletionStage<List<Person>>> run =
- Source.from(Arrays.asList(120))
+ Source.from(List.of(120))
.map((i) -> new Person(i, String.format("Java flow %d", i), new
Date()))
.via(flow)
.toMat(Sink.seq(), Keep.both())
diff --git a/google-cloud-bigquery/src/test/java/docs/javadsl/BigQueryDoc.java
b/google-cloud-bigquery/src/test/java/docs/javadsl/BigQueryDoc.java
index 3c1db7044..b338cde40 100644
--- a/google-cloud-bigquery/src/test/java/docs/javadsl/BigQueryDoc.java
+++ b/google-cloud-bigquery/src/test/java/docs/javadsl/BigQueryDoc.java
@@ -50,8 +50,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.Collections;
+import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.OptionalInt;
diff --git
a/google-cloud-pub-sub-grpc/src/test/java/org/apache/pekko/stream/connectors/googlecloud/pubsub/grpc/AutoExtendAckDeadlinesTest.java
b/google-cloud-pub-sub-grpc/src/test/java/org/apache/pekko/stream/connectors/googlecloud/pubsub/grpc/AutoExtendAckDeadlinesTest.java
index 3588e25fd..0b538cdaf 100644
---
a/google-cloud-pub-sub-grpc/src/test/java/org/apache/pekko/stream/connectors/googlecloud/pubsub/grpc/AutoExtendAckDeadlinesTest.java
+++
b/google-cloud-pub-sub-grpc/src/test/java/org/apache/pekko/stream/connectors/googlecloud/pubsub/grpc/AutoExtendAckDeadlinesTest.java
@@ -22,7 +22,6 @@ import static org.junit.Assert.*;
import com.google.protobuf.ByteString;
import com.google.pubsub.v1.*;
import java.time.Duration;
-import java.util.Arrays;
import java.util.List;
import java.util.concurrent.*;
import org.apache.pekko.Done;
@@ -161,7 +160,7 @@ public class AutoExtendAckDeadlinesTest {
public void fixedDeadlineShouldFailStreamWhenTickerFails() throws Exception {
GrpcSubscriber testSubscriber = new GrpcSubscriber(new
FailingSubscriberClient());
- List<ReceivedMessage> msgs = Arrays.asList(makeMsg("1"), makeMsg("2"),
makeMsg("3"));
+ List<ReceivedMessage> msgs = List.of(makeMsg("1"), makeMsg("2"),
makeMsg("3"));
CompletionStage<List<ReceivedMessage>> result =
Source.from(msgs)
@@ -209,7 +208,7 @@ public class AutoExtendAckDeadlinesTest {
public void fixedDeadlineShouldPassMessagesThroughWhenHealthy() throws
Exception {
GrpcSubscriber testSubscriber = new GrpcSubscriber(new
SucceedingSubscriberClient());
- List<ReceivedMessage> msgs = Arrays.asList(makeMsg("1"), makeMsg("2"),
makeMsg("3"));
+ List<ReceivedMessage> msgs = List.of(makeMsg("1"), makeMsg("2"),
makeMsg("3"));
List<ReceivedMessage> result =
Source.from(msgs)
@@ -230,7 +229,7 @@ public class AutoExtendAckDeadlinesTest {
GrpcSubscriber testSubscriber = new GrpcSubscriber(new
FailingSubscriberClient());
AckDeadlineDistribution dist = AckDeadlineDistribution.create();
- List<ReceivedMessage> msgs = Arrays.asList(makeMsg("1"), makeMsg("2"),
makeMsg("3"));
+ List<ReceivedMessage> msgs = List.of(makeMsg("1"), makeMsg("2"),
makeMsg("3"));
CompletionStage<List<ReceivedMessage>> result =
Source.from(msgs)
@@ -274,7 +273,7 @@ public class AutoExtendAckDeadlinesTest {
GrpcSubscriber testSubscriber = new GrpcSubscriber(new
SucceedingSubscriberClient());
AckDeadlineDistribution dist = AckDeadlineDistribution.create();
- List<ReceivedMessage> msgs = Arrays.asList(makeMsg("1"), makeMsg("2"),
makeMsg("3"));
+ List<ReceivedMessage> msgs = List.of(makeMsg("1"), makeMsg("2"),
makeMsg("3"));
List<ReceivedMessage> result =
Source.from(msgs)
diff --git a/google-cloud-storage/src/test/java/docs/javadsl/GCStorageTest.java
b/google-cloud-storage/src/test/java/docs/javadsl/GCStorageTest.java
index 7c99cf31a..6a4fa956c 100644
--- a/google-cloud-storage/src/test/java/docs/javadsl/GCStorageTest.java
+++ b/google-cloud-storage/src/test/java/docs/javadsl/GCStorageTest.java
@@ -33,7 +33,6 @@ import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
-import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletionStage;
@@ -302,7 +301,7 @@ public class GCStorageTest extends GCStorageWiremockBase {
final Source<StorageObject, NotUsed> listSource =
GCStorage.listBucket(this.bucketName());
assertEquals(
- Arrays.asList(firstFileName, secondFileName),
+ List.of(firstFileName, secondFileName),
listSource
.map(StorageObject::name)
.runWith(Sink.seq(), system())
@@ -333,7 +332,7 @@ public class GCStorageTest extends GCStorageWiremockBase {
// #list-bucket
assertEquals(
- Arrays.asList(firstFileName, secondFileName),
+ List.of(firstFileName, secondFileName),
listSource
.map(StorageObject::name)
.runWith(Sink.seq(), system())
@@ -341,7 +340,7 @@ public class GCStorageTest extends GCStorageWiremockBase {
.get(5, TimeUnit.SECONDS));
assertEquals(
- Arrays.asList(firstFileName, firstFileName + '#' + generation(),
secondFileName),
+ List.of(firstFileName, firstFileName + '#' + generation(),
secondFileName),
listVersionsSource
.map(StorageObject::name)
.runWith(Sink.seq(), system())
@@ -384,7 +383,7 @@ public class GCStorageTest extends GCStorageWiremockBase {
// #list-bucket-attributes
assertEquals(
- Arrays.asList(),
+ List.of(),
listSource
.map(StorageObject::name)
.runWith(Sink.seq(), system())
@@ -687,7 +686,7 @@ public class GCStorageTest extends GCStorageWiremockBase {
GCStorage.deleteObjectsByPrefix(bucketName(), prefix);
assertEquals(
- Arrays.asList(true, true),
+ List.of(true, true),
deleteObjectsByPrefixSource
.runWith(Sink.seq(), system())
.toCompletableFuture()
@@ -708,7 +707,7 @@ public class GCStorageTest extends GCStorageWiremockBase {
GCStorage.deleteObjectsByPrefix(bucketName(), prefix);
assertEquals(
- Arrays.asList(),
+ List.of(),
deleteObjectsByPrefixSource
.runWith(Sink.seq(), system())
.toCompletableFuture()
@@ -760,7 +759,7 @@ public class GCStorageTest extends GCStorageWiremockBase {
final Source<ByteString, NotUsed> source =
Source.from(
- Arrays.asList(
+ List.of(
ByteString.fromString(firstChunkContent),
ByteString.fromString(secondChunkContent)));
@@ -791,7 +790,7 @@ public class GCStorageTest extends GCStorageWiremockBase {
final Source<ByteString, NotUsed> source =
Source.from(
- Arrays.asList(
+ List.of(
ByteString.fromString(firstChunkContent),
ByteString.fromString(secondChunkContent)));
diff --git a/hbase/src/test/java/docs/javadsl/HBaseStageTest.java
b/hbase/src/test/java/docs/javadsl/HBaseStageTest.java
index 1d60bfd49..19352df10 100644
--- a/hbase/src/test/java/docs/javadsl/HBaseStageTest.java
+++ b/hbase/src/test/java/docs/javadsl/HBaseStageTest.java
@@ -34,7 +34,6 @@ import org.junit.Rule;
import org.junit.Test;
import java.io.UnsupportedEncodingException;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletionStage;
@@ -68,7 +67,7 @@ public class HBaseStageTest {
put.addColumn(
"info".getBytes("UTF-8"), "name".getBytes("UTF-8"),
person.name.getBytes("UTF-8"));
- return Collections.singletonList(put);
+ return List.of(put);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return Collections.emptyList();
@@ -84,7 +83,7 @@ public class HBaseStageTest {
append.add(
"info".getBytes("UTF-8"), "aliases".getBytes("UTF-8"),
person.name.getBytes("UTF-8"));
- return Collections.singletonList(append);
+ return List.of(append);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return Collections.emptyList();
@@ -98,7 +97,7 @@ public class HBaseStageTest {
try {
Delete delete = new Delete(String.format("id_%d",
person.id).getBytes("UTF-8"));
- return Collections.singletonList(delete);
+ return List.of(delete);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return Collections.emptyList();
@@ -113,7 +112,7 @@ public class HBaseStageTest {
Increment increment = new Increment(String.format("id_%d",
person.id).getBytes("UTF-8"));
increment.addColumn("info".getBytes("UTF-8"),
"numberOfChanges".getBytes("UTF-8"), 1);
- return Collections.singletonList(increment);
+ return List.of(increment);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return Collections.emptyList();
@@ -130,7 +129,7 @@ public class HBaseStageTest {
if (person.id != 0 && person.name.isEmpty()) {
Delete delete = new Delete(id);
- return Collections.singletonList(delete);
+ return List.of(delete);
} else if (person.id != 0) {
Put put = new Put(id);
put.addColumn(infoFamily, "name".getBytes("UTF-8"),
person.name.getBytes("UTF-8"));
@@ -138,7 +137,7 @@ public class HBaseStageTest {
Increment increment = new Increment(id);
increment.addColumn(infoFamily,
"numberOfChanges".getBytes("UTF-8"), 1);
- return Arrays.asList(put, increment);
+ return List.of(put, increment);
} else {
return Collections.emptyList();
}
@@ -158,14 +157,14 @@ public class HBaseStageTest {
HTableSettings.create(
HBaseConfiguration.create(),
TableName.valueOf("person1"),
- Collections.singletonList("info"),
+ List.of("info"),
hBaseConverter);
// #create-settings
// #sink
final Sink<Person, CompletionStage<Done>> sink =
HTableStage.sink(tableSettings);
CompletionStage<Done> o =
- Source.from(Arrays.asList(100, 101, 102, 103, 104))
+ Source.from(List.of(100, 101, 102, 103, 104))
.map((i) -> new Person(i, String.format("name %d", i)))
.runWith(sink, system);
// #sink
@@ -180,13 +179,13 @@ public class HBaseStageTest {
HTableSettings.create(
HBaseConfiguration.create(),
TableName.valueOf("person2"),
- Collections.singletonList("info"),
+ List.of("info"),
hBaseConverter);
// #flow
Flow<Person, Person, NotUsed> flow = HTableStage.flow(tableSettings);
Pair<NotUsed, CompletionStage<List<Person>>> run =
- Source.from(Arrays.asList(200, 201, 202, 203, 204))
+ Source.from(List.of(200, 201, 202, 203, 204))
.map((i) -> new Person(i, String.format("name_%d", i)))
.via(flow)
.toMat(Sink.seq(), Keep.both())
@@ -207,12 +206,12 @@ public class HBaseStageTest {
HTableSettings.create(
HBaseConfiguration.create(),
TableName.valueOf("person1"),
- Collections.singletonList("info"),
+ List.of("info"),
hBaseConverter);
final Sink<Person, CompletionStage<Done>> sink =
HTableStage.sink(tableSettings);
CompletionStage<Done> o =
- Source.from(Arrays.asList(new Person(300, "name 300"))).runWith(sink,
system);
+ Source.from(List.of(new Person(300, "name 300"))).runWith(sink,
system);
assertEquals(Done.getInstance(), o.toCompletableFuture().get(5,
TimeUnit.SECONDS));
// #source
diff --git a/hdfs/src/test/java/docs/javadsl/HdfsWriterTest.java
b/hdfs/src/test/java/docs/javadsl/HdfsWriterTest.java
index 893b3577e..a39132537 100644
--- a/hdfs/src/test/java/docs/javadsl/HdfsWriterTest.java
+++ b/hdfs/src/test/java/docs/javadsl/HdfsWriterTest.java
@@ -42,7 +42,6 @@ import scala.concurrent.duration.Duration;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
@@ -110,7 +109,7 @@ public class HdfsWriterTest {
List<RotationMessage> result = new
ArrayList<>(resF.toCompletableFuture().get());
List<RotationMessage> expect =
- Arrays.asList(
+ List.of(
new RotationMessage(output("0"), 0),
new RotationMessage(output("1"), 1),
new RotationMessage(output("2"), 2),
@@ -231,7 +230,7 @@ public class HdfsWriterTest {
// After we've written them to HDFS, we want
// to commit the offset to Kafka
List<KafkaMessage> messagesFromKafka =
- Arrays.asList(
+ List.of(
new KafkaMessage(new Book("Pekko Concurrency"), new
KafkaOffset(0)),
new KafkaMessage(new Book("Pekko in Action"), new KafkaOffset(1)),
new KafkaMessage(new Book("Effective Pekko"), new KafkaOffset(2)),
@@ -273,10 +272,10 @@ public class HdfsWriterTest {
ArrayList<RotationMessage> logs = new
ArrayList<>(resF.toCompletableFuture().get());
List<RotationMessage> expect =
- Arrays.asList(new RotationMessage(output("0"), 0), new
RotationMessage(output("1"), 1));
+ List.of(new RotationMessage(output("0"), 0), new
RotationMessage(output("1"), 1));
// Make sure all messages was committed to kafka
- assertEquals(Arrays.asList(0, 1, 2, 3, 4, 5),
kafkaCommitter.committedOffsets);
+ assertEquals(List.of(0, 1, 2, 3, 4, 5), kafkaCommitter.committedOffsets);
assertEquals(logs, expect);
JavaTestUtils.verifyOutputFileSize(fs, logs);
@@ -311,7 +310,7 @@ public class HdfsWriterTest {
List<RotationMessage> logs = new
ArrayList<>(resF.toCompletableFuture().get());
List<RotationMessage> expect =
- Arrays.asList(
+ List.of(
new RotationMessage(output("0.deflate"), 0),
new RotationMessage(output("1.deflate"), 1),
new RotationMessage(output("2.deflate"), 2),
@@ -337,7 +336,7 @@ public class HdfsWriterTest {
List<RotationMessage> logs = new
ArrayList<>(resF.toCompletableFuture().get());
List<RotationMessage> expect =
- Arrays.asList(
+ List.of(
new RotationMessage(output("0.deflate"), 0),
new RotationMessage(output("1.deflate"), 1),
new RotationMessage(output("2.deflate"), 2),
@@ -367,8 +366,7 @@ public class HdfsWriterTest {
.runWith(Sink.seq(), system);
List<RotationMessage> logs = new
ArrayList<>(resF.toCompletableFuture().get());
- List<RotationMessage> expect =
- Collections.singletonList(new RotationMessage(output("0.deflate"), 0));
+ List<RotationMessage> expect = List.of(new
RotationMessage(output("0.deflate"), 0));
assertEquals(logs, expect);
JavaTestUtils.verifyOutputFileSize(fs, logs);
diff --git a/influxdb/src/test/java/docs/javadsl/InfluxDbTest.java
b/influxdb/src/test/java/docs/javadsl/InfluxDbTest.java
index 532c522cf..c0f93c136 100644
--- a/influxdb/src/test/java/docs/javadsl/InfluxDbTest.java
+++ b/influxdb/src/test/java/docs/javadsl/InfluxDbTest.java
@@ -17,8 +17,6 @@ import java.time.Duration;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
@@ -178,7 +176,7 @@ public class InfluxDbTest {
// #run-flow
CompletableFuture<List<List<InfluxDbWriteResult<Point, NotUsed>>>>
completableFuture =
- Source.single(Collections.singletonList(influxDbWriteMessage))
+ Source.single(List.of(influxDbWriteMessage))
.via(InfluxDbFlow.create(influxDB))
.runWith(Sink.seq(), system)
.toCompletableFuture();
@@ -200,7 +198,7 @@ public class InfluxDbTest {
List<Integer> committedOffsets = new ArrayList<>();
List<MessageFromKafka> messageFromKafka =
- Arrays.asList(
+ List.of(
new MessageFromKafka(
new InfluxDbCpu(
Instant.now().minusSeconds(1000), "local_1", "eu-west-2",
1.4d, true, 123L),
@@ -240,7 +238,7 @@ public class InfluxDbTest {
.get(10, TimeUnit.SECONDS);
// #kafka-example
- assertEquals(Arrays.asList(0, 1, 2), committedOffsets);
+ assertEquals(List.of(0, 1, 2), committedOffsets);
List<String> result2 =
InfluxDbSource.typed(
diff --git a/ironmq/src/test/java/docs/javadsl/IronMqDocsTest.java
b/ironmq/src/test/java/docs/javadsl/IronMqDocsTest.java
index 8ae2a0002..7fe9e5cc8 100644
--- a/ironmq/src/test/java/docs/javadsl/IronMqDocsTest.java
+++ b/ironmq/src/test/java/docs/javadsl/IronMqDocsTest.java
@@ -34,7 +34,6 @@ import org.junit.Test;
import scala.concurrent.Await;
import java.time.Duration;
-import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
@@ -51,7 +50,7 @@ public class IronMqDocsTest extends IronMqClientForJava {
private static final Duration patience = Duration.ofSeconds(5);
private static final List<String> messages =
- Arrays.asList("test-1", "test-2", "test-3", "test-4", "test-5");
+ List.of("test-1", "test-2", "test-3", "test-4", "test-5");
private final IronMqSettings ironMqSettings = ironMqSettings();
diff --git
a/jakartams/src/test/java/docs/javadsl/JmsBufferedAckConnectorsTest.java
b/jakartams/src/test/java/docs/javadsl/JmsBufferedAckConnectorsTest.java
index d7988e2ba..fa4a1b177 100644
--- a/jakartams/src/test/java/docs/javadsl/JmsBufferedAckConnectorsTest.java
+++ b/jakartams/src/test/java/docs/javadsl/JmsBufferedAckConnectorsTest.java
@@ -38,7 +38,6 @@ import org.junit.Rule;
import org.junit.Test;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletionStage;
@@ -70,7 +69,7 @@ public class JmsBufferedAckConnectorsTest {
}
private List<JmsTextMessage> createTestMessageList() {
- List<Integer> intsIn = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+ List<Integer> intsIn = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
List<JmsTextMessage> msgsIn = new ArrayList<>();
for (Integer n : intsIn) {
msgsIn.add(
@@ -91,7 +90,7 @@ public class JmsBufferedAckConnectorsTest {
JmsProducer.textSink(
JmsProducerSettings.create(producerConfig,
connectionFactory).withQueue("test"));
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
Source.from(in).runWith(jmsSink, system);
Source<AckEnvelope, JmsConsumerControl> jmsSource =
@@ -308,7 +307,7 @@ public class JmsBufferedAckConnectorsTest {
public void publishAndConsumeTopic() throws Exception {
withConnectionFactory(
connectionFactory -> {
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
List<String> inNumbers =
IntStream.range(0,
10).boxed().map(String::valueOf).collect(Collectors.toList());
diff --git a/jakartams/src/test/java/docs/javadsl/JmsConnectorsTest.java
b/jakartams/src/test/java/docs/javadsl/JmsConnectorsTest.java
index 0851ce562..c5e37ab9b 100644
--- a/jakartams/src/test/java/docs/javadsl/JmsConnectorsTest.java
+++ b/jakartams/src/test/java/docs/javadsl/JmsConnectorsTest.java
@@ -108,7 +108,7 @@ public class JmsConnectorsTest {
}
private List<JmsTextMessage> createTestMessageList() {
- List<Integer> intsIn = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+ List<Integer> intsIn = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
List<JmsTextMessage> msgsIn = new ArrayList<>();
for (Integer n : intsIn) {
@@ -144,7 +144,7 @@ public class JmsConnectorsTest {
JmsProducer.textSink(
JmsProducerSettings.create(system,
connectionFactory).withQueue("test"));
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
CompletionStage<Done> finished = Source.from(in).runWith(jmsSink,
system);
// #text-sink
@@ -171,7 +171,7 @@ public class JmsConnectorsTest {
// #object-source
ActiveMQConnectionFactory connectionFactory =
new ActiveMQConnectionFactory(server.getVmURL());
- //
connectionFactory.(Arrays.asList(DummyJavaTests.class.getPackage().getName()));
+ //
connectionFactory.(List.of(DummyJavaTests.class.getPackage().getName()));
// #object-source
// #connection-factory-object
@@ -293,7 +293,7 @@ public class JmsConnectorsTest {
JmsProducerSettings.create(producerConfig,
connectionFactory).withQueue("test"));
CompletionStage<Done> finished =
- Source.from(Arrays.asList("Message A", "Message B"))
+ Source.from(List.of("Message A", "Message B"))
.map(JmsTextMessage::create)
.runWith(jmsSink, system);
// #create-jms-sink
@@ -476,7 +476,7 @@ public class JmsConnectorsTest {
public void publishAndConsumeTopic() throws Exception {
withConnectionFactory(
connectionFactory -> {
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
List<String> inNumbers =
IntStream.range(0,
10).boxed().map(String::valueOf).collect(Collectors.toList());
@@ -620,7 +620,7 @@ public class JmsConnectorsTest {
JmsProducer.textSink(
JmsProducerSettings.create(producerConfig,
connectionFactory).withQueue("test"));
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
Source.from(in).runWith(jmsSink, system).toCompletableFuture().get();
@@ -655,7 +655,7 @@ public class JmsConnectorsTest {
.setClientID(getClass().getSimpleName());
// #create-connection-factory-with-client-id
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
Sink<String, CompletionStage<Done>> jmsTopicSink =
JmsProducer.textSink(
@@ -711,7 +711,7 @@ public class JmsConnectorsTest {
JmsProducerSettings.create(system,
connectionFactory).withQueue("test"));
List<JmsTextMessage> input = new ArrayList<>();
- for (Integer n : Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) {
+ for (Integer n : List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) {
String queueName = (n % 2 == 0) ? "even" : "odd";
input.add(JmsTextMessage.create(n.toString()).toQueue(queueName));
}
@@ -733,8 +733,8 @@ public class JmsConnectorsTest {
.map(Integer::parseInt)
.runWith(Sink.seq(), system);
- assertEquals(Arrays.asList(1, 3, 5, 7, 9),
odd.toCompletableFuture().get());
- assertEquals(Arrays.asList(2, 4, 6, 8, 10),
even.toCompletableFuture().get());
+ assertEquals(List.of(1, 3, 5, 7, 9),
odd.toCompletableFuture().get());
+ assertEquals(List.of(2, 4, 6, 8, 10),
even.toCompletableFuture().get());
});
}
@@ -784,7 +784,7 @@ public class JmsConnectorsTest {
JmsProducer.flexiFlow(
JmsProducerSettings.create(producerConfig,
connectionFactory).withQueue("test"));
- List<String> data = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> data = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
List<JmsEnvelope<String>> input = new ArrayList<>();
for (String s : data) {
String passThrough = s;
@@ -816,7 +816,7 @@ public class JmsConnectorsTest {
JmsProducer.flexiFlow(
JmsProducerSettings.create(producerConfig,
connectionFactory).withQueue("test"));
- List<String> data = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> data = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
List<JmsEnvelope<String>> input = new ArrayList<>();
for (String s : data) {
String passThrough = s;
diff --git a/jakartams/src/test/java/docs/javadsl/JmsIbmmqConnectorsTest.java
b/jakartams/src/test/java/docs/javadsl/JmsIbmmqConnectorsTest.java
index 73be83c4d..fc4188970 100644
--- a/jakartams/src/test/java/docs/javadsl/JmsIbmmqConnectorsTest.java
+++ b/jakartams/src/test/java/docs/javadsl/JmsIbmmqConnectorsTest.java
@@ -41,7 +41,6 @@ import org.junit.Rule;
import org.junit.Test;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletionStage;
@@ -107,7 +106,7 @@ public class JmsIbmmqConnectorsTest {
// #ibmmq-queue
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h", "i",
"j", "k");
Source.from(in).runWith(jmsSink, system);
// #ibmmq-queue
@@ -156,7 +155,7 @@ public class JmsIbmmqConnectorsTest {
JmsProducerSettings.create(system, queueConnectionFactory)
.withDestination(new CustomDestination("custom",
createQueue(customQueue))));
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h", "i",
"j", "k");
Source.from(in).runWith(jmsSink, system);
@@ -177,7 +176,7 @@ public class JmsIbmmqConnectorsTest {
public void publishAndConsumeTopic()
throws JMSException, InterruptedException, ExecutionException,
TimeoutException {
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h", "i",
"j", "k");
// #ibmmq-topic
// Connect to IBM MQ over TCP/IP
diff --git a/jakartams/src/test/java/docs/javadsl/JmsTxConnectorsTest.java
b/jakartams/src/test/java/docs/javadsl/JmsTxConnectorsTest.java
index 02673c477..575cf50e6 100644
--- a/jakartams/src/test/java/docs/javadsl/JmsTxConnectorsTest.java
+++ b/jakartams/src/test/java/docs/javadsl/JmsTxConnectorsTest.java
@@ -39,7 +39,6 @@ import org.junit.Test;
import java.time.Duration;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletionStage;
@@ -71,7 +70,7 @@ public class JmsTxConnectorsTest {
}
private List<JmsTextMessage> createTestMessageList() {
- List<Integer> intsIn = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+ List<Integer> intsIn = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
List<JmsTextMessage> msgsIn = new ArrayList<>();
for (Integer n : intsIn) {
msgsIn.add(
@@ -92,7 +91,7 @@ public class JmsTxConnectorsTest {
JmsProducer.textSink(
JmsProducerSettings.create(producerConfig,
connectionFactory).withQueue("test"));
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
Source.from(in).runWith(jmsSink, system);
Source<TxEnvelope, JmsConsumerControl> jmsSource =
@@ -307,7 +306,7 @@ public class JmsTxConnectorsTest {
public void publishAndConsumeTopic() throws Exception {
withConnectionFactory(
connectionFactory -> {
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
List<String> inNumbers =
IntStream.range(0,
10).boxed().map(String::valueOf).collect(Collectors.toList());
diff --git
a/jakartams/src/test/java/org/apache/pekko/stream/connectors/jakartams/javadsl/JmsAckConnectorsTest.java
b/jakartams/src/test/java/org/apache/pekko/stream/connectors/jakartams/javadsl/JmsAckConnectorsTest.java
index 68fa8d0f5..b70adaddc 100644
---
a/jakartams/src/test/java/org/apache/pekko/stream/connectors/jakartams/javadsl/JmsAckConnectorsTest.java
+++
b/jakartams/src/test/java/org/apache/pekko/stream/connectors/jakartams/javadsl/JmsAckConnectorsTest.java
@@ -64,7 +64,7 @@ public class JmsAckConnectorsTest {
}
private List<JmsTextMessage> createTestMessageList() {
- List<Integer> intsIn = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+ List<Integer> intsIn = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
List<JmsTextMessage> msgsIn = new ArrayList<>();
for (Integer n : intsIn) {
final Map<String, Object> map = new HashMap<>();
@@ -86,7 +86,7 @@ public class JmsAckConnectorsTest {
JmsProducer.textSink(
JmsProducerSettings.create(producerConfig,
connectionFactory).withQueue("test"));
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
Source.from(in).runWith(jmsSink, system);
Source<AckEnvelope, JmsConsumerControl> jmsSource =
@@ -301,7 +301,7 @@ public class JmsAckConnectorsTest {
public void publishAndConsumeTopic() throws Exception {
withConnectionFactory(
connectionFactory -> {
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
List<String> inNumbers =
IntStream.range(0,
10).boxed().map(String::valueOf).collect(Collectors.toList());
diff --git a/jms/src/test/java/docs/javadsl/JmsBufferedAckConnectorsTest.java
b/jms/src/test/java/docs/javadsl/JmsBufferedAckConnectorsTest.java
index 4f60ab7db..f670c3cd0 100644
--- a/jms/src/test/java/docs/javadsl/JmsBufferedAckConnectorsTest.java
+++ b/jms/src/test/java/docs/javadsl/JmsBufferedAckConnectorsTest.java
@@ -66,7 +66,7 @@ public class JmsBufferedAckConnectorsTest {
}
private List<JmsTextMessage> createTestMessageList() {
- List<Integer> intsIn = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+ List<Integer> intsIn = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
List<JmsTextMessage> msgsIn = new ArrayList<>();
for (Integer n : intsIn) {
msgsIn.add(
@@ -89,7 +89,7 @@ public class JmsBufferedAckConnectorsTest {
JmsProducer.textSink(
JmsProducerSettings.create(producerConfig,
connectionFactory).withQueue("test"));
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
Source.from(in).runWith(jmsSink, system);
Source<AckEnvelope, JmsConsumerControl> jmsSource =
@@ -314,7 +314,7 @@ public class JmsBufferedAckConnectorsTest {
server -> {
ConnectionFactory connectionFactory =
server.createConnectionFactory();
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
List<String> inNumbers =
IntStream.range(0,
10).boxed().map(String::valueOf).collect(Collectors.toList());
diff --git a/jms/src/test/java/docs/javadsl/JmsConnectorsTest.java
b/jms/src/test/java/docs/javadsl/JmsConnectorsTest.java
index d03fb5f60..ce69db781 100644
--- a/jms/src/test/java/docs/javadsl/JmsConnectorsTest.java
+++ b/jms/src/test/java/docs/javadsl/JmsConnectorsTest.java
@@ -108,7 +108,7 @@ public class JmsConnectorsTest {
}
private List<JmsTextMessage> createTestMessageList() {
- List<Integer> intsIn = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+ List<Integer> intsIn = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
List<JmsTextMessage> msgsIn = new ArrayList<>();
for (Integer n : intsIn) {
@@ -144,7 +144,7 @@ public class JmsConnectorsTest {
JmsProducer.textSink(
JmsProducerSettings.create(system,
connectionFactory).withQueue("test"));
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
CompletionStage<Done> finished = Source.from(in).runWith(jmsSink,
system);
// #text-sink
@@ -172,7 +172,7 @@ public class JmsConnectorsTest {
ActiveMQConnectionFactory connectionFactory =
(ActiveMQConnectionFactory) server.createConnectionFactory();
connectionFactory.setTrustedPackages(
- Arrays.asList(DummyJavaTests.class.getPackage().getName()));
+ List.of(DummyJavaTests.class.getPackage().getName()));
// #object-source
// #connection-factory-object
@@ -307,7 +307,7 @@ public class JmsConnectorsTest {
JmsProducerSettings.create(producerConfig,
connectionFactory).withQueue("test"));
CompletionStage<Done> finished =
- Source.from(Arrays.asList("Message A", "Message B"))
+ Source.from(List.of("Message A", "Message B"))
.map(JmsTextMessage::create)
.runWith(jmsSink, system);
// #create-jms-sink
@@ -497,7 +497,7 @@ public class JmsConnectorsTest {
server -> {
ConnectionFactory connectionFactory =
server.createConnectionFactory();
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
List<String> inNumbers =
IntStream.range(0,
10).boxed().map(String::valueOf).collect(Collectors.toList());
@@ -650,7 +650,7 @@ public class JmsConnectorsTest {
JmsProducer.textSink(
JmsProducerSettings.create(producerConfig,
connectionFactory).withQueue("test"));
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
Source.from(in).runWith(jmsSink, system).toCompletableFuture().get();
@@ -690,7 +690,7 @@ public class JmsConnectorsTest {
.setClientID(getClass().getSimpleName());
// #create-connection-factory-with-client-id
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
Sink<String, CompletionStage<Done>> jmsTopicSink =
JmsProducer.textSink(
@@ -750,7 +750,7 @@ public class JmsConnectorsTest {
JmsProducerSettings.create(system,
connectionFactory).withQueue("test"));
List<JmsTextMessage> input = new ArrayList<>();
- for (Integer n : Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) {
+ for (Integer n : List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) {
String queueName = (n % 2 == 0) ? "even" : "odd";
input.add(JmsTextMessage.create(n.toString()).toQueue(queueName));
}
@@ -772,8 +772,8 @@ public class JmsConnectorsTest {
.map(Integer::parseInt)
.runWith(Sink.seq(), system);
- assertEquals(Arrays.asList(1, 3, 5, 7, 9),
odd.toCompletableFuture().get());
- assertEquals(Arrays.asList(2, 4, 6, 8, 10),
even.toCompletableFuture().get());
+ assertEquals(List.of(1, 3, 5, 7, 9),
odd.toCompletableFuture().get());
+ assertEquals(List.of(2, 4, 6, 8, 10),
even.toCompletableFuture().get());
});
}
@@ -824,7 +824,7 @@ public class JmsConnectorsTest {
JmsProducer.flexiFlow(
JmsProducerSettings.create(producerConfig,
connectionFactory).withQueue("test"));
- List<String> data = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> data = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
List<JmsEnvelope<String>> input = new ArrayList<>();
for (String s : data) {
String passThrough = s;
@@ -858,7 +858,7 @@ public class JmsConnectorsTest {
JmsProducer.flexiFlow(
JmsProducerSettings.create(producerConfig,
connectionFactory).withQueue("test"));
- List<String> data = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> data = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
List<JmsEnvelope<String>> input = new ArrayList<>();
for (String s : data) {
String passThrough = s;
diff --git a/jms/src/test/java/docs/javadsl/JmsIbmmqConnectorsTest.java
b/jms/src/test/java/docs/javadsl/JmsIbmmqConnectorsTest.java
index 0ce5a8022..a19af73b6 100644
--- a/jms/src/test/java/docs/javadsl/JmsIbmmqConnectorsTest.java
+++ b/jms/src/test/java/docs/javadsl/JmsIbmmqConnectorsTest.java
@@ -41,7 +41,6 @@ import javax.jms.JMSException;
import javax.jms.Session;
import javax.jms.TextMessage;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletionStage;
@@ -107,7 +106,7 @@ public class JmsIbmmqConnectorsTest {
// #ibmmq-queue
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h", "i",
"j", "k");
Source.from(in).runWith(jmsSink, system);
// #ibmmq-queue
@@ -156,7 +155,7 @@ public class JmsIbmmqConnectorsTest {
JmsProducerSettings.create(system, queueConnectionFactory)
.withDestination(new CustomDestination("custom",
createQueue(customQueue))));
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h", "i",
"j", "k");
Source.from(in).runWith(jmsSink, system);
@@ -177,7 +176,7 @@ public class JmsIbmmqConnectorsTest {
public void publishAndConsumeTopic()
throws JMSException, InterruptedException, ExecutionException,
TimeoutException {
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h", "i",
"j", "k");
// #ibmmq-topic
// Connect to IBM MQ over TCP/IP
diff --git a/jms/src/test/java/docs/javadsl/JmsTxConnectorsTest.java
b/jms/src/test/java/docs/javadsl/JmsTxConnectorsTest.java
index 5e865253f..5be3fad3b 100644
--- a/jms/src/test/java/docs/javadsl/JmsTxConnectorsTest.java
+++ b/jms/src/test/java/docs/javadsl/JmsTxConnectorsTest.java
@@ -67,7 +67,7 @@ public class JmsTxConnectorsTest {
}
private List<JmsTextMessage> createTestMessageList() {
- List<Integer> intsIn = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+ List<Integer> intsIn = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
List<JmsTextMessage> msgsIn = new ArrayList<>();
for (Integer n : intsIn) {
msgsIn.add(
@@ -90,7 +90,7 @@ public class JmsTxConnectorsTest {
JmsProducer.textSink(
JmsProducerSettings.create(producerConfig,
connectionFactory).withQueue("test"));
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
Source.from(in).runWith(jmsSink, system);
Source<TxEnvelope, JmsConsumerControl> jmsSource =
@@ -314,7 +314,7 @@ public class JmsTxConnectorsTest {
server -> {
ConnectionFactory connectionFactory =
server.createConnectionFactory();
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
List<String> inNumbers =
IntStream.range(0,
10).boxed().map(String::valueOf).collect(Collectors.toList());
diff --git
a/jms/src/test/java/org/apache/pekko/stream/connectors/jms/javadsl/JmsAckConnectorsTest.java
b/jms/src/test/java/org/apache/pekko/stream/connectors/jms/javadsl/JmsAckConnectorsTest.java
index 46379f116..295e0325c 100644
---
a/jms/src/test/java/org/apache/pekko/stream/connectors/jms/javadsl/JmsAckConnectorsTest.java
+++
b/jms/src/test/java/org/apache/pekko/stream/connectors/jms/javadsl/JmsAckConnectorsTest.java
@@ -63,7 +63,7 @@ public class JmsAckConnectorsTest {
}
private List<JmsTextMessage> createTestMessageList() {
- List<Integer> intsIn = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+ List<Integer> intsIn = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
List<JmsTextMessage> msgsIn = new ArrayList<>();
for (Integer n : intsIn) {
final Map<String, Object> map = new HashMap<>();
@@ -87,7 +87,7 @@ public class JmsAckConnectorsTest {
JmsProducer.textSink(
JmsProducerSettings.create(producerConfig,
connectionFactory).withQueue("test"));
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
Source.from(in).runWith(jmsSink, system);
Source<AckEnvelope, JmsConsumerControl> jmsSource =
@@ -310,7 +310,7 @@ public class JmsAckConnectorsTest {
server -> {
ConnectionFactory connectionFactory =
server.createConnectionFactory();
- List<String> in = Arrays.asList("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k");
+ List<String> in = List.of("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k");
List<String> inNumbers =
IntStream.range(0,
10).boxed().map(String::valueOf).collect(Collectors.toList());
diff --git a/kinesis/src/test/java/docs/javadsl/KinesisSnippets.java
b/kinesis/src/test/java/docs/javadsl/KinesisSnippets.java
index e841b5639..d70f0d696 100644
--- a/kinesis/src/test/java/docs/javadsl/KinesisSnippets.java
+++ b/kinesis/src/test/java/docs/javadsl/KinesisSnippets.java
@@ -36,7 +36,6 @@ import software.amazon.awssdk.services.kinesis.model.Record;
// #source-settings
import java.time.Duration;
-import java.util.Arrays;
import java.util.List;
public class KinesisSnippets {
@@ -73,7 +72,7 @@ public class KinesisSnippets {
// #source-list
final List<ShardSettings> mergeSettings =
- Arrays.asList(
+ List.of(
ShardSettings.create("streamName", "shard-id-1"),
ShardSettings.create("streamName", "shard-id-2"));
final Source<Record, NotUsed> two =
KinesisSource.basicMerge(mergeSettings, amazonKinesisAsync);
diff --git a/kudu/src/test/java/docs/javadsl/KuduTableTest.java
b/kudu/src/test/java/docs/javadsl/KuduTableTest.java
index 1abd27b72..1e74dbb69 100644
--- a/kudu/src/test/java/docs/javadsl/KuduTableTest.java
+++ b/kudu/src/test/java/docs/javadsl/KuduTableTest.java
@@ -39,8 +39,6 @@ import org.junit.Test;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
@@ -75,7 +73,7 @@ public class KuduTableTest {
};
// Kudu table options
- List<String> rangeKeys = Collections.singletonList("key");
+ List<String> rangeKeys = List.of("key");
CreateTableOptions createTableOptions =
new
CreateTableOptions().setNumReplicas(1).setRangePartitionColumns(rangeKeys);
@@ -98,7 +96,7 @@ public class KuduTableTest {
KuduTable.sink(tableSettings.withTableName("Sink"));
CompletionStage<Done> o =
- Source.from(Arrays.asList(100, 101, 102, 103, 104))
+ Source.from(List.of(100, 101, 102, 103, 104))
.map((i) -> new Person(i, String.format("name %d", i)))
.runWith(sink, system);
// #sink
@@ -111,7 +109,7 @@ public class KuduTableTest {
Flow<Person, Person, NotUsed> flow =
KuduTable.flow(tableSettings.withTableName("Flow"));
CompletionStage<List<Person>> run =
- Source.from(Arrays.asList(200, 201, 202, 203, 204))
+ Source.from(List.of(200, 201, 202, 203, 204))
.map((i) -> new Person(i, String.format("name_%d", i)))
.via(flow)
.toMat(Sink.seq(), Keep.right())
@@ -140,7 +138,7 @@ public class KuduTableTest {
// #attributes
CompletionStage<List<Person>> run =
- Source.from(Arrays.asList(200, 201, 202, 203, 204))
+ Source.from(List.of(200, 201, 202, 203, 204))
.map((i) -> new Person(i, String.format("name_%d", i)))
.via(flow)
.toMat(Sink.seq(), Keep.right())
diff --git a/mqtt/src/test/java/docs/javadsl/MqttSourceTest.java
b/mqtt/src/test/java/docs/javadsl/MqttSourceTest.java
index c4d00414f..ba88c2f34 100644
--- a/mqtt/src/test/java/docs/javadsl/MqttSourceTest.java
+++ b/mqtt/src/test/java/docs/javadsl/MqttSourceTest.java
@@ -41,7 +41,6 @@ import javax.net.ssl.SSLContext;
import static org.hamcrest.CoreMatchers.*;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.CompletionStage;
@@ -108,7 +107,7 @@ public class MqttSourceTest {
MqttConnectionSettings connectionSettings = baseConnectionSettings;
- final List<String> input = Arrays.asList("one", "two", "three", "four",
"five");
+ final List<String> input = List.of("one", "two", "three", "four", "five");
// #create-source-with-manualacks
Source<MqttMessageWithAck, CompletionStage<Done>> mqttSource =
@@ -174,7 +173,7 @@ public class MqttSourceTest {
final Sink<MqttMessage, CompletionStage<Done>> mqttSink =
MqttSink.create(sinkSettings, MqttQoS.atLeastOnce());
- final List<String> input = Arrays.asList("one", "two", "three", "four",
"five");
+ final List<String> input = List.of("one", "two", "three", "four", "five");
MqttConnectionSettings connectionSettings =
sourceSettings.withCleanSession(false);
MqttSubscriptions subscriptions = MqttSubscriptions.create(topic,
MqttQoS.atLeastOnce());
diff --git a/mqttv5/src/test/java/docs/javadsl/MqttSourceTest.java
b/mqttv5/src/test/java/docs/javadsl/MqttSourceTest.java
index a3baf7594..1519c0db3 100644
--- a/mqttv5/src/test/java/docs/javadsl/MqttSourceTest.java
+++ b/mqttv5/src/test/java/docs/javadsl/MqttSourceTest.java
@@ -42,7 +42,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.net.ssl.SSLContext;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.CompletionStage;
@@ -111,7 +110,7 @@ public class MqttSourceTest {
MqttConnectionSettings connectionSettings = baseConnectionSettings;
- final List<String> input = Arrays.asList("one", "two", "three", "four",
"five");
+ final List<String> input = List.of("one", "two", "three", "four", "five");
// #create-source-with-manualacks
Source<MqttMessageWithAck, CompletionStage<Done>> mqttSource =
@@ -177,7 +176,7 @@ public class MqttSourceTest {
final Sink<MqttMessage, CompletionStage<Done>> mqttSink =
MqttSink.create(sinkSettings, MqttQoS.atLeastOnce());
- final List<String> input = Arrays.asList("one", "two", "three", "four",
"five");
+ final List<String> input = List.of("one", "two", "three", "four", "five");
MqttConnectionSettings connectionSettings =
sourceSettings.withCleanStart(false);
MqttSubscriptions subscriptions = MqttSubscriptions.create(topic,
MqttQoS.atLeastOnce());
@@ -359,7 +358,7 @@ public class MqttSourceTest {
result.first().toCompletableFuture().get(5, TimeUnit.SECONDS);
List<MqttUserProperty> userPropsToSend =
- Arrays.asList(
+ List.of(
MqttUserProperty.create("x-trace-id", "abc123"),
MqttUserProperty.create("x-tenant", "acme"));
MqttMessage msg =
diff --git a/orientdb/src/test/java/docs/javadsl/OrientDbTest.java
b/orientdb/src/test/java/docs/javadsl/OrientDbTest.java
index 690096314..eeaf6f3f5 100644
--- a/orientdb/src/test/java/docs/javadsl/OrientDbTest.java
+++ b/orientdb/src/test/java/docs/javadsl/OrientDbTest.java
@@ -45,7 +45,6 @@ import org.junit.Test;
import java.time.Duration;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletionStage;
@@ -253,7 +252,7 @@ public class OrientDbTest {
List<String> res = new ArrayList<>(result.toCompletableFuture().get(10,
TimeUnit.SECONDS));
List<String> expect =
- Arrays.asList(
+ List.of(
"Akka Concurrency",
"Akka in Action",
"Effective Akka",
@@ -306,7 +305,7 @@ public class OrientDbTest {
List<String> result = new ArrayList<>(f2.toCompletableFuture().get(10,
TimeUnit.SECONDS));
List<String> expect =
- Arrays.asList(
+ List.of(
"Akka Concurrency",
"Akka in Action",
"Effective Akka",
@@ -328,7 +327,7 @@ public class OrientDbTest {
List<Integer> committedOffsets = new ArrayList<>();
List<messagesFromKafka> messagesFromKafkas =
- Arrays.asList(
+ List.of(
new messagesFromKafka("Akka Concurrency", new KafkaOffset(0)),
new messagesFromKafka("Akka in Action", new KafkaOffset(1)),
new messagesFromKafka("Effective Akka", new KafkaOffset(2)));
@@ -363,7 +362,7 @@ public class OrientDbTest {
.get(10, TimeUnit.SECONDS);
// #kafka-example
- assertEquals(Arrays.asList(0, 1, 2), committedOffsets);
+ assertEquals(List.of(0, 1, 2), committedOffsets);
List<Object> result2 =
OrientDbSource.create(sink6, OrientDbSourceSettings.create(oDatabase),
null)
@@ -403,7 +402,7 @@ public class OrientDbTest {
List<String> result2 = new ArrayList<>(f2.toCompletableFuture().get(10,
TimeUnit.SECONDS));
List<String> expect =
- Arrays.asList(
+ List.of(
"Akka Concurrency",
"Akka in Action",
"Effective Akka",
diff --git a/pravega/src/test/java/docs/javadsl/PravegaReadWriteDocs.java
b/pravega/src/test/java/docs/javadsl/PravegaReadWriteDocs.java
index 90edeb96b..67c1661bb 100644
--- a/pravega/src/test/java/docs/javadsl/PravegaReadWriteDocs.java
+++ b/pravega/src/test/java/docs/javadsl/PravegaReadWriteDocs.java
@@ -29,7 +29,6 @@ import io.pravega.client.stream.impl.UTF8StringSerializer;
import io.pravega.client.tables.TableKey;
import java.nio.ByteBuffer;
-import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletionStage;
@@ -50,7 +49,7 @@ public class PravegaReadWriteDocs extends
PravegaPekkoTestCaseSupport {
Pravega.sink("an_existing_scope", "an_existing_scope", writerSettings);
CompletionStage<Done> doneWithRouting =
- Source.from(Arrays.asList("One", "Two",
"Three")).runWith(sinkWithRouting, system);
+ Source.from(List.of("One", "Two", "Three")).runWith(sinkWithRouting,
system);
// #writing
@@ -93,7 +92,7 @@ public class PravegaReadWriteDocs extends
PravegaPekkoTestCaseSupport {
// #table-writing
final List<Pair<Integer, String>> events =
- Arrays.asList(
+ List.of(
new Pair<Integer, String>(1, "One"),
new Pair<Integer, String>(2, "Two"),
new Pair<Integer, String>(3, "Three"),
diff --git
a/pravega/src/test/java/org/apache/pekko/stream/connectors/pravega/PravegaGraphTestCase.java
b/pravega/src/test/java/org/apache/pekko/stream/connectors/pravega/PravegaGraphTestCase.java
index 7c5af30b3..382b907c1 100644
---
a/pravega/src/test/java/org/apache/pekko/stream/connectors/pravega/PravegaGraphTestCase.java
+++
b/pravega/src/test/java/org/apache/pekko/stream/connectors/pravega/PravegaGraphTestCase.java
@@ -32,8 +32,6 @@ import org.apache.pekko.stream.javadsl.Keep;
import org.apache.pekko.stream.javadsl.Sink;
import org.apache.pekko.stream.connectors.pravega.javadsl.Pravega;
-import java.util.Arrays;
-
import java.util.List;
import java.util.concurrent.*;
@@ -68,7 +66,7 @@ public class PravegaGraphTestCase extends PravegaBaseTestCase
{
createStream(scope, streamName);
- final List<String> events = Arrays.asList("One", "Two", "Three");
+ final List<String> events = List.of("One", "Two", "Three");
Sink<String, CompletionStage<Done>> sinkWithRouting =
Pravega.sink(scope, streamName, writerSettings);
diff --git
a/pravega/src/test/java/org/apache/pekko/stream/connectors/pravega/PravegaKVTableTestCase.java
b/pravega/src/test/java/org/apache/pekko/stream/connectors/pravega/PravegaKVTableTestCase.java
index 1e5c55d9a..dd1951562 100644
---
a/pravega/src/test/java/org/apache/pekko/stream/connectors/pravega/PravegaKVTableTestCase.java
+++
b/pravega/src/test/java/org/apache/pekko/stream/connectors/pravega/PravegaKVTableTestCase.java
@@ -35,7 +35,6 @@ import org.junit.BeforeClass;
import org.junit.Test;
import java.nio.ByteBuffer;
-import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@@ -75,7 +74,7 @@ public class PravegaKVTableTestCase extends
PravegaBaseTestCase {
throws ExecutionException, InterruptedException, TimeoutException {
final List<Pair<Integer, String>> events =
- Arrays.asList(
+ List.of(
new Pair<Integer, String>(1, "One"),
new Pair<Integer, String>(2, "Two"),
new Pair<Integer, String>(3, "Three"),
@@ -111,7 +110,7 @@ public class PravegaKVTableTestCase extends
PravegaBaseTestCase {
Flow<Integer, Optional<String>, NotUsed> readFlow =
PravegaTable.readFlow(scope, tableName, tableReaderSettings);
- List<Integer> ids = Arrays.asList(1, 2, 3, 4);
+ List<Integer> ids = List.of(1, 2, 3, 4);
CompletionStage<List<String>> readFlowFut =
Source.from(ids)
@@ -127,7 +126,7 @@ public class PravegaKVTableTestCase extends
PravegaBaseTestCase {
List<String> values =
readFlowFut.toCompletableFuture().get(timeoutSeconds, TimeUnit.SECONDS);
- Assert.assertEquals(values, Arrays.asList("One", "Two", "Three", "Four"));
+ Assert.assertEquals(values, List.of("One", "Two", "Three", "Four"));
}
@BeforeClass
diff --git a/reference/src/test/java/docs/javadsl/ReferenceTest.java
b/reference/src/test/java/docs/javadsl/ReferenceTest.java
index d8a4b466d..4290ff326 100644
--- a/reference/src/test/java/docs/javadsl/ReferenceTest.java
+++ b/reference/src/test/java/docs/javadsl/ReferenceTest.java
@@ -96,7 +96,7 @@ public class ReferenceTest {
final CompletionStage<ReferenceReadResult> stage =
source.runWith(Sink.head(), system);
final ReferenceReadResult msg = stage.toCompletableFuture().get(5,
TimeUnit.SECONDS);
-
Assert.assertEquals(Collections.singletonList(ByteString.fromString("one")),
msg.getData());
+ Assert.assertEquals(List.of(ByteString.fromString("one")), msg.getData());
final OptionalInt expected = OptionalInt.of(100);
Assert.assertEquals(expected, msg.getBytesRead());
@@ -118,13 +118,13 @@ public class ReferenceTest {
final Source<ReferenceWriteMessage, NotUsed> source =
Source.from(
- Arrays.asList(
+ List.of(
ReferenceWriteMessage.create()
-
.withData(Collections.singletonList(ByteString.fromString("one")))
+ .withData(List.of(ByteString.fromString("one")))
.withMetrics(metrics),
ReferenceWriteMessage.create()
.withData(
- Arrays.asList(
+ List.of(
ByteString.fromString("two"),
ByteString.fromString("three"),
ByteString.fromString("four")))));
@@ -139,7 +139,7 @@ public class ReferenceTest {
.collect(Collectors.toList());
Assert.assertEquals(
- Arrays.asList(
+ List.of(
ByteString.fromString("one"),
ByteString.fromString("two"),
ByteString.fromString("three"),
@@ -154,15 +154,14 @@ public class ReferenceTest {
public void resolveResourceFromApplicationConfig() throws Exception {
final List<ReferenceWriteResult> result =
Source.single(
- ReferenceWriteMessage.create()
-
.withData(Collections.singletonList(ByteString.fromString("one"))))
+
ReferenceWriteMessage.create().withData(List.of(ByteString.fromString("one"))))
.via(Reference.flowWithResource())
.runWith(Sink.seq(), system)
.toCompletableFuture()
.get(5, TimeUnit.SECONDS);
Assert.assertEquals(
- Collections.singletonList("one default msg"),
+ List.of("one default msg"),
result.stream()
.flatMap(m -> m.getMessage().getData().stream())
.map(ByteString::utf8String)
@@ -173,8 +172,7 @@ public class ReferenceTest {
public void useResourceFromAttributes() throws Exception {
final List<ReferenceWriteResult> result =
Source.single(
- ReferenceWriteMessage.create()
-
.withData(Collections.singletonList(ByteString.fromString("one"))))
+
ReferenceWriteMessage.create().withData(List.of(ByteString.fromString("one"))))
.via(
Reference.flowWithResource()
.withAttributes(
@@ -185,7 +183,7 @@ public class ReferenceTest {
.get(5, TimeUnit.SECONDS);
Assert.assertEquals(
- Collections.singletonList("one attributes msg"),
+ List.of("one attributes msg"),
result.stream()
.flatMap(m -> m.getMessage().getData().stream())
.map(ByteString::utf8String)
diff --git a/solr/src/test/java/docs/javadsl/SolrTest.java
b/solr/src/test/java/docs/javadsl/SolrTest.java
index a77a6bfe8..495f3afa2 100644
--- a/solr/src/test/java/docs/javadsl/SolrTest.java
+++ b/solr/src/test/java/docs/javadsl/SolrTest.java
@@ -56,6 +56,7 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.time.Duration;
+import java.util.Collections;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
@@ -164,7 +165,7 @@ public class SolrTest {
List<String> result = new ArrayList<>(resultOf(res2));
List<String> expect =
- Arrays.asList(
+ List.of(
"Akka Concurrency",
"Akka in Action",
"Effective Akka",
@@ -228,7 +229,7 @@ public class SolrTest {
List<String> result = new ArrayList<>(resultOf(res2));
List<String> expect =
- Arrays.asList(
+ List.of(
"Akka Concurrency",
"Akka in Action",
"Effective Akka",
@@ -277,7 +278,7 @@ public class SolrTest {
List<String> result = new ArrayList<>(resultOf(res2));
List<String> expect =
- Arrays.asList(
+ List.of(
"Akka Concurrency",
"Akka in Action",
"Effective Akka",
@@ -326,7 +327,7 @@ public class SolrTest {
List<String> result = new ArrayList<>(resultOf(res2));
List<String> expect =
- Arrays.asList(
+ List.of(
"Akka Concurrency",
"Akka in Action",
"Effective Akka",
@@ -343,7 +344,7 @@ public class SolrTest {
String collectionName = createCollection();
List<CommittableMessage> messagesFromKafka =
- Arrays.asList(
+ List.of(
new CommittableMessage(new Book("Book 1"), new
CommittableOffset(0)),
new CommittableMessage(new Book("Book 2"), new
CommittableOffset(1)),
new CommittableMessage(new Book("Book 3"), new
CommittableOffset(2)));
@@ -389,7 +390,7 @@ public class SolrTest {
// Make sure all messages was committed to kafka
assertEquals(
- Arrays.asList(0, 1, 2),
+ List.of(0, 1, 2),
CommittableOffsetBatch.committedOffsets.stream()
.map(o -> o.offset)
.collect(Collectors.toList()));
@@ -545,7 +546,7 @@ public class SolrTest {
List<String> result = new ArrayList<>(resultOf(res3));
List<String> expect =
- Arrays.asList(
+ List.of(
"Akka Concurrency. Written by good authors. It's is a good
book!!!",
"Akka in Action. Written by good authors. It's is a good book!!!",
"Effective Akka. Written by good authors. It's is a good book!!!",
@@ -632,7 +633,7 @@ public class SolrTest {
List<String> result = new ArrayList<>(resultOf(res3));
List<String> expect =
- Arrays.asList(
+ List.of(
"Akka Concurrency. Written by good authors. It's is a good
book!!!",
"Akka in Action. Written by good authors. It's is a good book!!!",
"Effective Akka. Written by good authors. It's is a good book!!!",
@@ -716,7 +717,7 @@ public class SolrTest {
String collectionName = createCollection();
List<CommittableOffset> messagesFromKafka =
- Arrays.asList(new CommittableOffset(0), new CommittableOffset(1), new
CommittableOffset(2));
+ List.of(new CommittableOffset(0), new CommittableOffset(1), new
CommittableOffset(2));
CommittableOffsetBatch.committedOffsets.clear();
@@ -758,7 +759,7 @@ public class SolrTest {
// Make sure all messages was committed to kafka
assertEquals(
- Arrays.asList(0, 1, 2),
+ List.of(0, 1, 2),
CommittableOffsetBatch.committedOffsets.stream()
.map(o -> o.offset)
.collect(Collectors.toList()));
@@ -856,7 +857,7 @@ public class SolrTest {
// #init-client
CloudSolrClient solrClient =
- new CloudSolrClient.Builder(Arrays.asList(zookeeperHost),
Optional.empty()).build();
+ new CloudSolrClient.Builder(List.of(zookeeperHost),
Optional.empty()).build();
// #init-client
SolrTest.solrClient = solrClient;
diff --git a/sqs/src/test/java/docs/javadsl/SqsSourceTest.java
b/sqs/src/test/java/docs/javadsl/SqsSourceTest.java
index 0d306938b..898ada571 100644
--- a/sqs/src/test/java/docs/javadsl/SqsSourceTest.java
+++ b/sqs/src/test/java/docs/javadsl/SqsSourceTest.java
@@ -35,7 +35,6 @@ import
software.amazon.awssdk.services.sqs.model.SendMessageRequest;
import java.net.URI;
import java.time.Duration;
-import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
@@ -87,7 +86,7 @@ public class SqsSourceTest extends BaseSqsTest {
.withMaxBufferSize(100)
.withMaxBatchSize(10)
.withAttributes(
- Arrays.asList(
+ List.of(
MessageSystemAttributeName.senderId(),
MessageSystemAttributeName.sentTimestamp()))
.withMessageAttribute(MessageAttributeName.create("bar.*"))
diff --git a/text/src/test/java/docs/javadsl/CharsetCodingFlowsDoc.java
b/text/src/test/java/docs/javadsl/CharsetCodingFlowsDoc.java
index 03f122cf4..7edce2b43 100644
--- a/text/src/test/java/docs/javadsl/CharsetCodingFlowsDoc.java
+++ b/text/src/test/java/docs/javadsl/CharsetCodingFlowsDoc.java
@@ -32,7 +32,6 @@ import org.junit.Test;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.CompletionStage;
@@ -91,7 +90,7 @@ public class CharsetCodingFlowsDoc {
.runWith(Sink.seq(), system);
// #decoding
List<String> result = streamCompletion.toCompletableFuture().get(1,
TimeUnit.SECONDS);
- assertEquals(Arrays.asList("äåûßêëé"), result);
+ assertEquals(List.of("äåûßêëé"), result);
}
@Test
diff --git a/xml/src/test/java/docs/javadsl/XmlParsingTest.java
b/xml/src/test/java/docs/javadsl/XmlParsingTest.java
index 27c03250b..d6da83868 100644
--- a/xml/src/test/java/docs/javadsl/XmlParsingTest.java
+++ b/xml/src/test/java/docs/javadsl/XmlParsingTest.java
@@ -34,7 +34,6 @@ import org.junit.Rule;
import org.junit.Test;
import org.w3c.dom.Element;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@@ -179,7 +178,7 @@ public class XmlParsingTest {
Flow.<String>create()
.map(ByteString::fromString)
.via(XmlParsing.parser())
- .via(XmlParsing.subslice(Arrays.asList("doc", "elem", "item")))
+ .via(XmlParsing.subslice(List.of("doc", "elem", "item")))
.toMat(Sink.seq(), Keep.right());
// #subslice
@@ -219,7 +218,7 @@ public class XmlParsingTest {
Flow.<String>create()
.map(ByteString::fromString)
.via(XmlParsing.parser())
- .via(XmlParsing.subtree(Arrays.asList("doc", "elem", "item")))
+ .via(XmlParsing.subtree(List.of("doc", "elem", "item")))
.toMat(Sink.seq(), Keep.right());
// #subtree
diff --git a/xml/src/test/java/docs/javadsl/XmlWritingTest.java
b/xml/src/test/java/docs/javadsl/XmlWritingTest.java
index 6c086b64c..0635ca0c3 100644
--- a/xml/src/test/java/docs/javadsl/XmlWritingTest.java
+++ b/xml/src/test/java/docs/javadsl/XmlWritingTest.java
@@ -34,8 +34,8 @@ import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
-import java.util.ArrayList;
import java.util.Collections;
+import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletionStage;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]