nizhikov commented on code in PR #15873:
URL: https://github.com/apache/kafka/pull/15873#discussion_r1592249836
##########
core/src/test/java/kafka/admin/ConfigCommandUnitTest.java:
##########
@@ -418,4 +880,77 @@ public static String[] toArray(String... first) {
public static String[] toArray(List<String>... lists) {
return Stream.of(lists).flatMap(List::stream).toArray(String[]::new);
}
+
+ @SafeVarargs
+ public static List<String> concat(List<String>... lists) {
+ return
Stream.of(lists).flatMap(List::stream).collect(Collectors.toList());
+ }
+
+ @SafeVarargs
+ public static <K, V> Map<K, V> concat(Map<K, V>...maps) {
+ Map<K, V> res = new HashMap<>();
Review Comment:
Thanks.
~~Used your version of method.~~
Actually, we can't use this version (I have similar at first), because, some
values of concatenating maps is null ang `merge` function used in
`Collectors.toMap` checks `value` is not null:
```
@Override
public V merge(K key, V value,
BiFunction<? super V, ? super V, ? extends V>
remappingFunction) {
if (value == null)
throw new NullPointerException();
if (remappingFunction == null)
throw new NullPointerException();
...
```
--
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]