mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
bugfix
This commit is contained in:
@@ -5,6 +5,7 @@ import lombok.experimental.UtilityClass;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiFunction;
|
||||
@@ -47,7 +48,7 @@ public class CollectionUtils {
|
||||
public static <A, B, K> List<Tuple2<A, B>> leftHashJoin(Iterable<A> a, Iterable<B> b, Function<A, K> ak, Function<B, K> bk) {
|
||||
Map<K, List<A>> aMap = newStream(a).collect(Collectors.groupingBy(ak));
|
||||
Map<K, List<B>> bMap = newStream(b).collect(Collectors.groupingBy(bk));
|
||||
return aMap.keySet().stream().flatMap(k -> aMap.getOrDefault(k, new ArrayList<>()).stream().flatMap(av -> bMap.getOrDefault(k, List.of((B) null)).stream().map(bv -> new Tuple2<>(av, bv)))).collect(java.util.stream.Collectors.toList());
|
||||
return aMap.keySet().stream().flatMap(k -> aMap.getOrDefault(k, new ArrayList<>()).stream().flatMap(av -> bMap.getOrDefault(k, new ArrayList<>(Arrays.asList((B)null))).stream().map(bv -> new Tuple2<>(av, bv)))).collect(java.util.stream.Collectors.toList());
|
||||
}
|
||||
|
||||
public static <A, B> List<Tuple2<A, B>> leftNestJoin(Iterable<A> a, Iterable<B> b, BiFunction<A, B, Boolean> test) {
|
||||
|
||||
Reference in New Issue
Block a user