YeonCheolGit commented on code in PR #12019:
URL: https://github.com/apache/kafka/pull/12019#discussion_r862396035
##########
connect/runtime/src/main/java/org/apache/kafka/connect/util/ConnectUtils.java:
##########
@@ -160,4 +166,40 @@ public static boolean isSourceConnector(Connector
connector) {
return SourceConnector.class.isAssignableFrom(connector.getClass());
}
+ public static <K, I, O> Map<K, O> transformValues(Map<K, I> map,
Function<I, O> transformation) {
+ return map.entrySet().stream().collect(Collectors.toMap(
+ Map.Entry::getKey,
+ transformation.compose(Map.Entry::getValue)
+ ));
+ }
+
+ public static <I> List<I> combineCollections(Collection<? extends
Collection<I>> collections) {
+ return combineCollections(collections, Function.identity());
+ }
+
+ public static <I, T> List<T> combineCollections(Collection<? extends I>
collection, Function<I, Collection<T>> extractCollection) {
+ return combineCollections(collection, extractCollection,
Collectors.toList());
+ }
+
+ public static <I, T, C> C combineCollections(
Review Comment:
Could you explain why `combineCollections` return `combineCollections` then
return `combineCollections`?
For me, It looks final returning result is always `<I, T, C> C
combineCollections`. Why not using only `<I, T, C> C combineCollections`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]