Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CONNECTOR] rewrite sink connector by java 17 toList #1754

Merged
merged 1 commit into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.kafka.common.config.ConfigDef;
import org.astraea.common.Configuration;
import org.astraea.common.VersionUtils;
Expand Down Expand Up @@ -53,9 +52,7 @@ public final Class<? extends org.apache.kafka.connect.sink.SinkTask> taskClass()

@Override
public List<Map<String, String>> taskConfigs(int maxTasks) {
return takeConfiguration(maxTasks).stream()
.map(Configuration::raw)
.collect(Collectors.toList());
return takeConfiguration(maxTasks).stream().map(Configuration::raw).toList();
}

@Override
Expand Down
3 changes: 1 addition & 2 deletions connector/src/main/java/org/astraea/connector/SinkTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.kafka.connect.data.Schema;
import org.apache.kafka.connect.errors.DataException;
import org.apache.kafka.connect.header.Headers;
Expand Down Expand Up @@ -57,7 +56,7 @@ public final void start(Map<String, String> props) {
@Override
public final void put(Collection<SinkRecord> records) {
if (records != null && !records.isEmpty())
put(records.stream().map(SinkTask::toRecord).collect(Collectors.toList()));
put(records.stream().map(SinkTask::toRecord).toList());
}

private static byte[] toBytes(Schema schema, Object value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.LongAdder;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;
import org.astraea.common.Configuration;
Expand Down Expand Up @@ -128,7 +127,7 @@ protected Class<? extends SinkTask> task() {

@Override
protected List<Configuration> takeConfiguration(int maxTasks) {
return IntStream.range(0, maxTasks).mapToObj(ignored -> configs).collect(Collectors.toList());
return IntStream.range(0, maxTasks).mapToObj(ignored -> configs).toList();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import java.time.Duration;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.astraea.common.Configuration;
import org.astraea.common.Utils;
Expand Down Expand Up @@ -50,7 +49,7 @@ protected Class<? extends SinkTask> task() {

@Override
protected List<Configuration> takeConfiguration(int maxTasks) {
return IntStream.range(0, maxTasks).mapToObj(i -> config).collect(Collectors.toList());
return IntStream.range(0, maxTasks).mapToObj(i -> config).toList();
}

@Override
Expand Down