import org.eclipse.collections.api.list.ImmutableList;
import org.eclipse.collections.impl.factory.Lists;
import java.util.List;
import java.util.function.BiFunction;
import java.util.stream.Collectors;
public class ZipWithSample {
public static <T, S, U> ImmutableList<U> zipWith(BiFunction<T, S, U> f, ImmutableList<T> xs, ImmutableList<S> ys) {
return xs.zip(ys).collect(p -> f.apply(p.getOne(), p.getTwo()));
}
private static ImmutableList<String> strToList(String str) {
final List<String> characterList = str.chars().mapToObj(c -> (char) c).map(String::valueOf).collect(Collectors.toList());
return Lists.immutable.ofAll(characterList);
}
public static void main(String args[]) {
final String pt = "パトカー";
final String tx = "タクシー";
System.out.println(zipWith(((p, t) -> p + t), strToList(pt), strToList(tx)).makeString(""));
}
}