java.util.function.LongToDoubleFunction Java Examples

The following examples show how to use java.util.function.LongToDoubleFunction. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LongPipeline.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
@Override
public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    Objects.requireNonNull(mapper);
    return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
            return new Sink.ChainedLong<Double>(sink) {
                @Override
                public void accept(long t) {
                    downstream.accept(mapper.applyAsDouble(t));
                }
            };
        }
    };
}
 
Example #2
Source File: LongPipeline.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
@Override
public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    Objects.requireNonNull(mapper);
    return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
            return new Sink.ChainedLong<Double>(sink) {
                @Override
                public void accept(long t) {
                    downstream.accept(mapper.applyAsDouble(t));
                }
            };
        }
    };
}
 
Example #3
Source File: LongPipeline.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    Objects.requireNonNull(mapper);
    return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
            return new Sink.ChainedLong<Double>(sink) {
                @Override
                public void accept(long t) {
                    downstream.accept(mapper.applyAsDouble(t));
                }
            };
        }
    };
}
 
Example #4
Source File: LongPipeline.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    Objects.requireNonNull(mapper);
    return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
            return new Sink.ChainedLong<Double>(sink) {
                @Override
                public void accept(long t) {
                    downstream.accept(mapper.applyAsDouble(t));
                }
            };
        }
    };
}
 
Example #5
Source File: LongPipeline.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    Objects.requireNonNull(mapper);
    return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
            return new Sink.ChainedLong<Double>(sink) {
                @Override
                public void accept(long t) {
                    downstream.accept(mapper.applyAsDouble(t));
                }
            };
        }
    };
}
 
Example #6
Source File: LongPipeline.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    Objects.requireNonNull(mapper);
    return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
            return new Sink.ChainedLong<Double>(sink) {
                @Override
                public void accept(long t) {
                    downstream.accept(mapper.applyAsDouble(t));
                }
            };
        }
    };
}
 
Example #7
Source File: LongPipeline.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
@Override
public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    Objects.requireNonNull(mapper);
    return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
            return new Sink.ChainedLong<Double>(sink) {
                @Override
                public void accept(long t) {
                    downstream.accept(mapper.applyAsDouble(t));
                }
            };
        }
    };
}
 
Example #8
Source File: LongPipeline.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    Objects.requireNonNull(mapper);
    return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
            return new Sink.ChainedLong<Double>(sink) {
                @Override
                public void accept(long t) {
                    downstream.accept(mapper.applyAsDouble(t));
                }
            };
        }
    };
}
 
Example #9
Source File: LongPipeline.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    Objects.requireNonNull(mapper);
    return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
            return new Sink.ChainedLong<Double>(sink) {
                @Override
                public void accept(long t) {
                    downstream.accept(mapper.applyAsDouble(t));
                }
            };
        }
    };
}
 
Example #10
Source File: LongPipeline.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    Objects.requireNonNull(mapper);
    return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
            return new Sink.ChainedLong<Double>(sink) {
                @Override
                public void accept(long t) {
                    downstream.accept(mapper.applyAsDouble(t));
                }
            };
        }
    };
}
 
Example #11
Source File: LongPipeline.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    Objects.requireNonNull(mapper);
    return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
            return new Sink.ChainedLong<Double>(sink) {
                @Override
                public void accept(long t) {
                    downstream.accept(mapper.applyAsDouble(t));
                }
            };
        }
    };
}
 
Example #12
Source File: LongPipeline.java    From desugar_jdk_libs with GNU General Public License v2.0 6 votes vote down vote up
@Override
public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    Objects.requireNonNull(mapper);
    return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
            return new Sink.ChainedLong<Double>(sink) {
                @Override
                public void accept(long t) {
                    downstream.accept(mapper.applyAsDouble(t));
                }
            };
        }
    };
}
 
Example #13
Source File: LongPipeline.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    Objects.requireNonNull(mapper);
    return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
            return new Sink.ChainedLong<Double>(sink) {
                @Override
                public void accept(long t) {
                    downstream.accept(mapper.applyAsDouble(t));
                }
            };
        }
    };
}
 
Example #14
Source File: LongPipeline.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
@Override
public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    Objects.requireNonNull(mapper);
    return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
            return new Sink.ChainedLong<Double>(sink) {
                @Override
                public void accept(long t) {
                    downstream.accept(mapper.applyAsDouble(t));
                }
            };
        }
    };
}
 
Example #15
Source File: LongPipeline.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    Objects.requireNonNull(mapper);
    return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
            return new Sink.ChainedLong<Double>(sink) {
                @Override
                public void accept(long t) {
                    downstream.accept(mapper.applyAsDouble(t));
                }
            };
        }
    };
}
 
Example #16
Source File: LongPipeline.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    Objects.requireNonNull(mapper);
    return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
            return new Sink.ChainedLong<Double>(sink) {
                @Override
                public void accept(long t) {
                    downstream.accept(mapper.applyAsDouble(t));
                }
            };
        }
    };
}
 
Example #17
Source File: LongPipeline.java    From j2objc with Apache License 2.0 6 votes vote down vote up
@Override
public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    Objects.requireNonNull(mapper);
    return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        public Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
            return new Sink.ChainedLong<Double>(sink) {
                @Override
                public void accept(long t) {
                    downstream.accept(mapper.applyAsDouble(t));
                }
            };
        }
    };
}
 
Example #18
Source File: LongPipeline.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    Objects.requireNonNull(mapper);
    return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
            return new Sink.ChainedLong<Double>(sink) {
                @Override
                public void accept(long t) {
                    downstream.accept(mapper.applyAsDouble(t));
                }
            };
        }
    };
}
 
Example #19
Source File: LongPipeline.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public final DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    Objects.requireNonNull(mapper);
    return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Long> opWrapSink(int flags, Sink<Double> sink) {
            return new Sink.ChainedLong<Double>(sink) {
                @Override
                public void accept(long t) {
                    downstream.accept(mapper.applyAsDouble(t));
                }
            };
        }
    };
}
 
Example #20
Source File: LongStreamEx.java    From streamex with Apache License 2.0 4 votes vote down vote up
@Override
public DoubleStreamEx mapToDouble(LongToDoubleFunction mapper) {
    return new DoubleStreamEx(stream().mapToDouble(mapper), context);
}
 
Example #21
Source File: DoubleValuesSource.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
private FieldValuesSource(String field, LongToDoubleFunction decoder) {
  this.field = field;
  this.decoder = decoder;
}
 
Example #22
Source File: StatelessDistributionSummary.java    From spectator with Apache License 2.0 4 votes vote down vote up
private Measurement newMeasurement(Id mid, LongToDoubleFunction getAndSet) {
  double delta = getAndSet.applyAsDouble(0);
  long timestamp = clock.wallTime();
  return new Measurement(mid, timestamp, delta);
}
 
Example #23
Source File: StatelessTimer.java    From spectator with Apache License 2.0 4 votes vote down vote up
private Measurement newMeasurement(Id mid, LongToDoubleFunction getAndSet) {
  double delta = getAndSet.applyAsDouble(0);
  long timestamp = clock.wallTime();
  return new Measurement(mid, timestamp, delta);
}
 
Example #24
Source File: DefaultMethodStreams.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DoubleStream mapToDouble(LongToDoubleFunction mapper) {
    return s.mapToDouble(mapper);
}
 
Example #25
Source File: LongStreamEx.java    From streamex with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the maximum element of this stream according to the provided key
 * extractor function.
 *
 * <p>
 * This is a terminal operation.
 *
 * @param keyExtractor a non-interfering, stateless function
 * @return an {@code OptionalLong} describing the first element of this
 *         stream for which the highest value was returned by key extractor,
 *         or an empty {@code OptionalLong} if the stream is empty
 * @since 0.1.2
 */
public OptionalLong maxByDouble(LongToDoubleFunction keyExtractor) {
    return collect(PrimitiveBox::new, (box, l) -> {
        double key = keyExtractor.applyAsDouble(l);
        if (!box.b || Double.compare(box.d, key) < 0) {
            box.b = true;
            box.d = key;
            box.l = l;
        }
    }, PrimitiveBox.MAX_DOUBLE).asLong();
}
 
Example #26
Source File: LongStreamEx.java    From streamex with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the minimum element of this stream according to the provided key
 * extractor function.
 *
 * <p>
 * This is a terminal operation.
 *
 * @param keyExtractor a non-interfering, stateless function
 * @return an {@code OptionalLong} describing the first element of this
 *         stream for which the lowest value was returned by key extractor,
 *         or an empty {@code OptionalLong} if the stream is empty
 * @since 0.1.2
 */
public OptionalLong minByDouble(LongToDoubleFunction keyExtractor) {
    return collect(PrimitiveBox::new, (box, l) -> {
        double key = keyExtractor.applyAsDouble(l);
        if (!box.b || Double.compare(box.d, key) > 0) {
            box.b = true;
            box.d = key;
            box.l = l;
        }
    }, PrimitiveBox.MIN_DOUBLE).asLong();
}
 
Example #27
Source File: LongStream.java    From desugar_jdk_libs with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a {@code DoubleStream} consisting of the results of applying the
 * given function to the elements of this stream.
 *
 * <p>This is an <a href="package-summary.html#StreamOps">intermediate
 * operation</a>.
 *
 * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
 *               <a href="package-summary.html#Statelessness">stateless</a>
 *               function to apply to each element
 * @return the new stream
 */
DoubleStream mapToDouble(LongToDoubleFunction mapper);
 
Example #28
Source File: LongStream.java    From jdk1.8-source-analysis with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a {@code DoubleStream} consisting of the results of applying the
 * given function to the elements of this stream.
 *
 * <p>This is an <a href="package-summary.html#StreamOps">intermediate
 * operation</a>.
 *
 * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
 *               <a href="package-summary.html#Statelessness">stateless</a>
 *               function to apply to each element
 * @return the new stream
 */
DoubleStream mapToDouble(LongToDoubleFunction mapper);
 
Example #29
Source File: LongStream.java    From dragonwell8_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a {@code DoubleStream} consisting of the results of applying the
 * given function to the elements of this stream.
 *
 * <p>This is an <a href="package-summary.html#StreamOps">intermediate
 * operation</a>.
 *
 * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
 *               <a href="package-summary.html#Statelessness">stateless</a>
 *               function to apply to each element
 * @return the new stream
 */
DoubleStream mapToDouble(LongToDoubleFunction mapper);
 
Example #30
Source File: LongStream.java    From j2objc with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a {@code DoubleStream} consisting of the results of applying the
 * given function to the elements of this stream.
 *
 * <p>This is an <a href="package-summary.html#StreamOps">intermediate
 * operation</a>.
 *
 * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
 *               <a href="package-summary.html#Statelessness">stateless</a>
 *               function to apply to each element
 * @return the new stream
 */
DoubleStream mapToDouble(LongToDoubleFunction mapper);