/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
public FlatMapToDoubleAction(Function<? super T, ? extends DoubleStream> mapper) { super(s -> s.flatMapToDouble(requireNonNull(mapper)), DoubleStream.class, FLAT_MAP_TO); }
/** * 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())); }
@Override public DoubleStream flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper) { requireNonNull(mapper); if (STRICT) { return toStream().flatMapToDouble(mapper); } return mapper.apply(element); }
@Override public DoubleStream flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper) { requireNonNull(mapper); return materialize().flatMapToDouble(mapper); }
@Override public DoubleStream build(boolean parallel) { return previous().build(parallel).flatMapToDouble(mapper); } }
@Override public DoubleStream flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper) { return wrap(stream().flatMapToDouble(mapper)); }
@Override public DoubleStream flatMapToDouble(final Function<? super T, ? extends DoubleStream> mapper) { return unwrapStream().flatMapToDouble(mapper); }
@Override public DoubleStream flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper) { return stream().flatMapToDouble(mapper); }
@Override public DoubleStream flatMapToDouble( Function<? super T, ? extends DoubleStream> mapper) { realizeStream(); return wrappedStream.flatMapToDouble(mapper); }
@Override public DoubleStream flatMapToDouble( final Function<? super T, ? extends DoubleStream> mapper ) { return _self.flatMapToDouble(mapper); }
@Override public DoubleStream flatMapToDouble( Function<? super Entry<K, V>, ? extends DoubleStream> mapper) { return delegate.flatMapToDouble(mapper); }
@Override default DoubleStream flatMapToDouble( Function<? super U, ? extends DoubleStream> mapper) { return stream().flatMapToDouble(mapper); }
@Override public DoubleStream flatMapToDouble(Function<? super T, ? extends DoubleStream> mapper) { return stream().flatMapToDouble(mapper); }
/** 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)); }
/** * 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); }