本文整理了Java中io.vavr.collection.List.flatMap()
方法的一些代码示例,展示了List.flatMap()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。List.flatMap()
方法的具体详情如下:
包路径:io.vavr.collection.List
类名称:List
方法名:flatMap
暂无
代码示例来源:origin: vavr-io/vavr
/**
* Yields a result for elements of the cross product of the underlying Lists.
*
* @param f a function that maps an element of the cross product to a result
* @param <R> type of the resulting {@code List} elements
* @return an {@code List} of mapped results
*/
public <R> List<R> yield(Function8<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? extends R> f) {
Objects.requireNonNull(f, "f is null");
return
ts1.flatMap(t1 ->
ts2.flatMap(t2 ->
ts3.flatMap(t3 ->
ts4.flatMap(t4 ->
ts5.flatMap(t5 ->
ts6.flatMap(t6 ->
ts7.flatMap(t7 ->
ts8.map(t8 -> f.apply(t1, t2, t3, t4, t5, t6, t7, t8)))))))));
}
代码示例来源:origin: vavr-io/vavr
/**
* Yields a result for elements of the cross product of the underlying Lists.
*
* @param f a function that maps an element of the cross product to a result
* @param <R> type of the resulting {@code List} elements
* @return an {@code List} of mapped results
*/
public <R> List<R> yield(Function7<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? extends R> f) {
Objects.requireNonNull(f, "f is null");
return
ts1.flatMap(t1 ->
ts2.flatMap(t2 ->
ts3.flatMap(t3 ->
ts4.flatMap(t4 ->
ts5.flatMap(t5 ->
ts6.flatMap(t6 ->
ts7.map(t7 -> f.apply(t1, t2, t3, t4, t5, t6, t7))))))));
}
代码示例来源:origin: vavr-io/vavr
/**
* Yields a result for elements of the cross product of the underlying Lists.
*
* @param f a function that maps an element of the cross product to a result
* @param <R> type of the resulting {@code List} elements
* @return an {@code List} of mapped results
*/
public <R> List<R> yield(Function6<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? extends R> f) {
Objects.requireNonNull(f, "f is null");
return
ts1.flatMap(t1 ->
ts2.flatMap(t2 ->
ts3.flatMap(t3 ->
ts4.flatMap(t4 ->
ts5.flatMap(t5 ->
ts6.map(t6 -> f.apply(t1, t2, t3, t4, t5, t6)))))));
}
代码示例来源:origin: vavr-io/vavr
/**
* Yields a result for elements of the cross product of the underlying Lists.
*
* @param f a function that maps an element of the cross product to a result
* @param <R> type of the resulting {@code List} elements
* @return an {@code List} of mapped results
*/
public <R> List<R> yield(Function5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> f) {
Objects.requireNonNull(f, "f is null");
return
ts1.flatMap(t1 ->
ts2.flatMap(t2 ->
ts3.flatMap(t3 ->
ts4.flatMap(t4 ->
ts5.map(t5 -> f.apply(t1, t2, t3, t4, t5))))));
}
代码示例来源:origin: vavr-io/vavr
/**
* Yields a result for elements of the cross product of the underlying Lists.
*
* @param f a function that maps an element of the cross product to a result
* @param <R> type of the resulting {@code List} elements
* @return an {@code List} of mapped results
*/
public <R> List<R> yield(Function4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> f) {
Objects.requireNonNull(f, "f is null");
return
ts1.flatMap(t1 ->
ts2.flatMap(t2 ->
ts3.flatMap(t3 ->
ts4.map(t4 -> f.apply(t1, t2, t3, t4)))));
}
代码示例来源:origin: vavr-io/vavr
/**
* Yields a result for elements of the cross product of the underlying Lists.
*
* @param f a function that maps an element of the cross product to a result
* @param <R> type of the resulting {@code List} elements
* @return an {@code List} of mapped results
*/
public <R> List<R> yield(BiFunction<? super T1, ? super T2, ? extends R> f) {
Objects.requireNonNull(f, "f is null");
return
ts1.flatMap(t1 ->
ts2.map(t2 -> f.apply(t1, t2)));
}
代码示例来源:origin: vavr-io/vavr
/**
* Yields a result for elements of the cross product of the underlying Lists.
*
* @param f a function that maps an element of the cross product to a result
* @param <R> type of the resulting {@code List} elements
* @return an {@code List} of mapped results
*/
public <R> List<R> yield(Function3<? super T1, ? super T2, ? super T3, ? extends R> f) {
Objects.requireNonNull(f, "f is null");
return
ts1.flatMap(t1 ->
ts2.flatMap(t2 ->
ts3.map(t3 -> f.apply(t1, t2, t3))));
}
代码示例来源:origin: vavr-io/vavr
@Override
public <U> Queue<U> flatMap(Function<? super T, ? extends Iterable<? extends U>> mapper) {
Objects.requireNonNull(mapper, "mapper is null");
if (isEmpty()) {
return empty();
} else {
return new Queue<>(front.flatMap(mapper), rear.flatMap(mapper));
}
}
代码示例来源:origin: vavr-io/vavr
@Override
default List<List<T>> combinations() {
return rangeClosed(0, length()).map(this::combinations).flatMap(Function.identity());
}
代码示例来源:origin: apache/incubator-pinot
@Override
public Map<String, ?> unhandleChildKeys(java.util.List<T> values, String pathPrefix) {
if (values == null) {
return null;
}
return List.ofAll(values).flatMap(value -> {
Map<String, ?> serializedValue = Serializer.serialize(value);
final String name = (String) serializedValue.getOrElse("name", null);
return serializedValue.remove("name").mapKeys(key -> name + "." + key);
}).toMap(Function.identity());
}
}
代码示例来源:origin: vavr-io/vavr
static <T> List<List<T>> apply(List<T> elements, int k) {
if (k == 0) {
return List.of(List.empty());
} else {
return elements.zipWithIndex().flatMap(
t -> apply(elements.drop(t._2 + 1), (k - 1)).map(c -> c.prepend(t._1))
);
}
}
}
代码示例来源:origin: com.pragmaticobjects.oo.atom/atom-basis
@Override
public final List<Path> paths() {
return classPaths.flatMap(ClassPath::paths);
}
}
代码示例来源:origin: com.pragmaticobjects.oo.atom/atom-basis
@Override
public final List<String> errors(TypeDescription type) {
return validators.flatMap(v -> v.errors(type));
}
}
代码示例来源:origin: io.vavr/vavr
/**
* Yields a result for elements of the cross product of the underlying Lists.
*
* @param f a function that maps an element of the cross product to a result
* @param <R> type of the resulting {@code List} elements
* @return an {@code List} of mapped results
*/
public <R> List<R> yield(BiFunction<? super T1, ? super T2, ? extends R> f) {
Objects.requireNonNull(f, "f is null");
return
ts1.flatMap(t1 ->
ts2.map(t2 -> f.apply(t1, t2)));
}
代码示例来源:origin: io.vavr/vavr
@Override
public <U> Queue<U> flatMap(Function<? super T, ? extends Iterable<? extends U>> mapper) {
Objects.requireNonNull(mapper, "mapper is null");
if (isEmpty()) {
return empty();
} else {
return new Queue<>(front.flatMap(mapper), rear.flatMap(mapper));
}
}
代码示例来源:origin: io.vavr/vavr
@Override
default List<List<T>> combinations() {
return rangeClosed(0, length()).map(this::combinations).flatMap(Function.identity());
}
代码示例来源:origin: io.vavr/vavr
static <T> List<List<T>> apply(List<T> elements, int k) {
if (k == 0) {
return List.of(List.empty());
} else {
return elements.zipWithIndex().flatMap(
t -> apply(elements.drop(t._2 + 1), (k - 1)).map(c -> c.prepend(t._1))
);
}
}
}
代码示例来源:origin: com.pragmaticobjects.oo.atom/atom-basis
@Override
public final StackManipulationToken stackManipulationToken() {
return new SmtCombined(
List.of(type)
.flatMap(TypeDescription::getDeclaredFields)
.filter(f -> !f.isStatic())
.map(f -> new SmtCheckAtomFieldEquality(type, f))
.toJavaArray(SmtCheckAtomFieldEquality.class)
);
}
}
代码示例来源:origin: com.pragmaticobjects.oo.atom/atom-basis
@Override
public final StackManipulationToken stackManipulationToken() {
NaturalJavaAtom naturalMatcher = new NaturalJavaAtom();
return new SmtArray(
List.of(type)
.flatMap(TypeDescription::getDeclaredFields)
.filter(f -> !f.isStatic())
.filter(f -> !naturalMatcher.matches(f.getType().asErasure()))
.map(f -> new SmtLoadField(f))
.toJavaArray(SmtLoadField.class)
);
}
}
代码示例来源:origin: com.pragmaticobjects.oo.atom/atom-basis
@Override
public final StackManipulationToken stackManipulationToken() {
NaturalJavaAtom naturalMatcher = new NaturalJavaAtom();
return new SmtArray(
List.of(type)
.flatMap(TypeDescription::getDeclaredFields)
.filter(f -> !f.isStatic())
.filter(f -> naturalMatcher.matches(f.getType().asErasure()))
.map(f -> new SmtLoadField(f))
.toJavaArray(SmtLoadField.class)
);
}
}
内容来源于网络,如有侵权,请联系作者删除!