io.vavr.collection.Vector.flatMap()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(197)

本文整理了Java中io.vavr.collection.Vector.flatMap()方法的一些代码示例,展示了Vector.flatMap()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vector.flatMap()方法的具体详情如下:
包路径:io.vavr.collection.Vector
类名称:Vector
方法名:flatMap

Vector.flatMap介绍

暂无

代码示例

代码示例来源:origin: vavr-io/vavr

@Override
public IndexedSeq<CharSeq> combinations() {
  return Vector.rangeClosed(0, length()).map(this::combinations).flatMap(Function.identity());
}

代码示例来源:origin: vavr-io/vavr

@Override
public Vector<Vector<T>> combinations() { return rangeClosed(0, length()).map(this::combinations).flatMap(Function.identity()); }

代码示例来源:origin: vavr-io/vavr

static <T> Vector<Vector<T>> apply(Vector<T> elements, int k) {
    return (k == 0)
        ? Vector.of(Vector.empty())
        : elements.zipWithIndex().flatMap(
        t -> apply(elements.drop(t._2 + 1), (k - 1)).map((Vector<T> c) -> c.prepend(t._1)));
  }
}

代码示例来源:origin: martincooper/java-datatable

/**
 * FlatMap implementation for the DataRowCollection class.
 *
 * @param <U> Mapped return type.
 * @param mapper The map function.
 * @return Returns a sequence of the applied flatMap.
 */
public <U> Seq<U> flatMap(Function<? super DataRow, ? extends Iterable <? extends U>> mapper) {
  return this.rows.flatMap(mapper);
}

代码示例来源:origin: io.vavr/vavr

@Override
public IndexedSeq<CharSeq> combinations() {
  return Vector.rangeClosed(0, length()).map(this::combinations).flatMap(Function.identity());
}

代码示例来源:origin: io.vavr/vavr

@Override
public Vector<Vector<T>> combinations() { return rangeClosed(0, length()).map(this::combinations).flatMap(Function.identity()); }

代码示例来源:origin: io.vavr/vavr

static <T> Vector<Vector<T>> apply(Vector<T> elements, int k) {
    return (k == 0)
        ? Vector.of(Vector.empty())
        : elements.zipWithIndex().flatMap(
        t -> apply(elements.drop(t._2 + 1), (k - 1)).map((Vector<T> c) -> c.prepend(t._1)));
  }
}

相关文章