本文整理了Java中java.util.stream.Stream.flatMapToDouble()
方法的一些代码示例,展示了Stream.flatMapToDouble()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Stream.flatMapToDouble()
方法的具体详情如下:
包路径:java.util.stream.Stream
类名称:Stream
方法名:flatMapToDouble
[英]Returns an DoubleStream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element. Each mapped stream is java.util.stream.BaseStream#close() after its contents have placed been into this stream. (If a mapped stream is null an empty stream is used, instead.)
This is an intermediate operation.
[中]返回一个DoubleStream,该流由将提供的映射函数应用于每个元素而生成的映射流的内容替换该流的每个元素的结果组成。每个映射流都是java。util。流动BaseStream的内容放入此流后关闭()。(如果映射流为空,则使用空流。)
这是一个intermediate operation。
代码示例来源:origin: google/guava
/**
* Returns a {@link DoubleStream} containing the elements of the first stream, followed by the
* elements of the second stream, and so on.
*
* <p>This is equivalent to {@code Stream.of(streams).flatMapToDouble(stream -> stream)}, but the
* returned stream may perform better.
*
* @see DoubleStream#concat(DoubleStream, DoubleStream)
*/
public static DoubleStream concat(DoubleStream... streams) {
// TODO(lowasser): optimize this later
return Stream.of(streams).flatMapToDouble(stream -> stream);
}
代码示例来源:origin: prestodb/presto
/**
* Returns a {@link DoubleStream} containing the elements of the first stream, followed by the
* elements of the second stream, and so on.
*
* <p>This is equivalent to {@code Stream.of(streams).flatMapToDouble(stream -> stream)}, but the
* returned stream may perform better.
*
* @see DoubleStream#concat(DoubleStream, DoubleStream)
*/
public static DoubleStream concat(DoubleStream... streams) {
// TODO(lowasser): optimize this later
return Stream.of(streams).flatMapToDouble(stream -> stream);
}
代码示例来源:origin: google/j2objc
/**
* Returns a {@link DoubleStream} containing the elements of the first stream, followed by the
* elements of the second stream, and so on.
*
* <p>This is equivalent to {@code Stream.of(streams).flatMapToDouble(stream -> stream)}, but the
* returned stream may perform better.
*
* @see DoubleStream#concat(DoubleStream, DoubleStream)
*/
public static DoubleStream concat(DoubleStream... streams) {
// TODO(lowasser): optimize this later
return Stream.of(streams).flatMapToDouble(stream -> stream);
}
代码示例来源:origin: speedment/speedment
/**
* Returns an {@code DoubleStream} consisting of the results of replacing
* each element of this stream with the contents of a mapped stream produced
* by applying the provided mapping function to each element. Each mapped
* stream is {@link java.util.stream.BaseStream#close() closed} after its
* contents have placed been into this stream. (If a mapped stream is
* {@code null} an empty stream is used, instead.)
* <p>
* This is an intermediate operation.
*
* @param mapper a non-interfering, stateless function to apply to each
* element which produces a stream of new elements
* @return the new stream
*
* @see #flatMap(Function)
*/
@Override
public DoubleStream flatMapToDouble(Function<? super Map.Entry<K, V>, ? extends DoubleStream> mapper) {
return inner.flatMapToDouble(mapper);
}
代码示例来源:origin: wildfly/wildfly
/**
* Returns a {@link DoubleStream} containing the elements of the first stream, followed by the
* elements of the second stream, and so on.
*
* <p>This is equivalent to {@code Stream.of(streams).flatMapToDouble(stream -> stream)}, but the
* returned stream may perform better.
*
* @see DoubleStream#concat(DoubleStream, DoubleStream)
*/
public static DoubleStream concat(DoubleStream... streams) {
// TODO(lowasser): optimize this later
return Stream.of(streams).flatMapToDouble(stream -> stream);
}
代码示例来源:origin: speedment/speedment
public FlatMapToDoubleAction(Function<? super T, ? extends DoubleStream> mapper) {
super(s -> s.flatMapToDouble(requireNonNull(mapper)), DoubleStream.class, FLAT_MAP_TO);
}
代码示例来源:origin: speedment/speedment
/**
* Returns an {@code DoubleStream} consisting of the results of replacing
* each key-value pair of this stream with the contents of a mapped stream
* produced by applying the provided mapping function to each element. Each
* mapped stream is {@link java.util.stream.BaseStream#close() closed} after
* its contents have placed been into this stream. (If a mapped stream is
* {@code null} an empty stream is used, instead.)
* <p>
* This is an intermediate operation.
*
* @param mapper a non-interfering, stateless function to apply to each
* key-value pair which produces a stream of new elements
* @return the new stream
*
* @see #flatMap(Function)
*/
public DoubleStream flatMapToDouble(BiFunction<? super K, ? super V, ? extends DoubleStream> mapper) {
return inner.flatMapToDouble(e -> mapper.apply(e.getKey(), e.getValue()));
}
代码示例来源:origin: speedment/speedment
@Override
public DoubleStream flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper) {
requireNonNull(mapper);
if (STRICT) {
return toStream().flatMapToDouble(mapper);
}
return mapper.apply(element);
}
代码示例来源:origin: speedment/speedment
@Override
public DoubleStream flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper) {
requireNonNull(mapper);
return materialize().flatMapToDouble(mapper);
}
代码示例来源:origin: speedment/speedment
@Override
public DoubleStream build(boolean parallel) {
return previous().build(parallel).flatMapToDouble(mapper);
}
}
代码示例来源:origin: speedment/speedment
@Override
public DoubleStream flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper) {
return wrap(stream().flatMapToDouble(mapper));
}
代码示例来源:origin: aol/cyclops
@Override
public DoubleStream flatMapToDouble(final Function<? super T, ? extends DoubleStream> mapper) {
return unwrapStream().flatMapToDouble(mapper);
}
代码示例来源:origin: lenskit/lenskit
@Override
public DoubleStream flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper) {
return stream().flatMapToDouble(mapper);
}
代码示例来源:origin: my2iu/Jinq
@Override
public DoubleStream flatMapToDouble(
Function<? super T, ? extends DoubleStream> mapper)
{
realizeStream();
return wrappedStream.flatMapToDouble(mapper);
}
代码示例来源:origin: jenetics/jenetics
@Override
public DoubleStream flatMapToDouble(
final Function<? super T, ? extends DoubleStream> mapper
) {
return _self.flatMapToDouble(mapper);
}
代码示例来源:origin: poetix/protonpack
@Override
public DoubleStream flatMapToDouble(
Function<? super Entry<K, V>, ? extends DoubleStream> mapper) {
return delegate.flatMapToDouble(mapper);
}
代码示例来源:origin: com.aol.simplereact/simple-react
@Override
default DoubleStream flatMapToDouble(
Function<? super U, ? extends DoubleStream> mapper) {
return stream().flatMapToDouble(mapper);
}
代码示例来源:origin: org.jooq/jool
@Override
public DoubleStream flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper) {
return stream().flatMapToDouble(mapper);
}
代码示例来源:origin: com.google.mug/mug
/** Maps a single pair to zero or more {@code double}s. */
public DoubleStream flatMapToDouble(
BiFunction<? super K, ? super V, ? extends DoubleStream> mapper) {
return underlying.flatMapToDouble(forEntries(mapper));
}
代码示例来源:origin: com.simiacryptus/java-util
/**
* Gets percentile.
*
* @param percentile the percentile
* @return the percentile
*/
public synchronized Double getPercentile(final double percentile) {
if (null == values) return Double.NaN;
return values.parallelStream().flatMapToDouble(x -> Arrays.stream(x)).sorted().skip((int) (percentile * values.size())).findFirst().orElse(Double.NaN);
}
内容来源于网络,如有侵权,请联系作者删除!