下面列出了java.util.stream.Stream#mapToDouble ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private DoubleStream mapToDouble(Stream<NullableContainer<String>> stream) {
// BUG: Diagnostic contains: dereferenced expression
return stream.mapToDouble(c -> c.get().length());
}
/**
* Constructs a time discretization using the given tick size.
*
* @param times A non closed and not necessarily sorted stream containing the time points.
* @param tickSize A non-negative double representing the smallest time span distinguishable.
* @param allowDuplicates If true, the time discretization allows duplicate entries.
*/
public TimeDiscretizationFromArray(final Stream<Double> times, final double tickSize, final boolean allowDuplicates) {
this(times.mapToDouble(Double::doubleValue), tickSize, allowDuplicates);
}
/**
* Constructs a time discretization using the given tick size.
* The time discretization will be sorted. Duplicate entries are allowed if <code>allowDuplicates</code> is true, otherwise duplicate entries are removed.
*
* @param times A non closed and not necessarily sorted stream containing the time points.
* @param tickSize A non-negative double representing the smallest time span distinguishable.
*/
public TimeDiscretizationFromArray(final Stream<Double> times, final double tickSize) {
this(times.mapToDouble(Double::doubleValue), tickSize, false);
}
/**
* Constructs a time discretization from a (non closed and not necessarily sorted) stream of boxed doubles.
*
* @param times A double stream of time points for the time discretization.
*/
public TimeDiscretizationFromArray(final Stream<Double> times) {
this(times.mapToDouble(Double::doubleValue), timeTickSizeDefault, false);
}
/**
* Constructs a time discretization using the given tick size.
*
* @param times A non closed and not necessarily sorted stream containing the time points.
* @param tickSize A non-negative double representing the smallest time span distinguishable.
* @param allowDuplicates If true, the time discretization allows duplicate entries.
*/
public TimeDiscretizationFromArray(final Stream<Double> times, final double tickSize, final boolean allowDuplicates) {
this(times.mapToDouble(Double::doubleValue), tickSize, allowDuplicates);
}
/**
* Constructs a time discretization using the given tick size.
* The time discretization will be sorted. Duplicate entries are allowed if <code>allowDuplicates</code> is true, otherwise duplicate entries are removed.
*
* @param times A non closed and not necessarily sorted stream containing the time points.
* @param tickSize A non-negative double representing the smallest time span distinguishable.
*/
public TimeDiscretizationFromArray(final Stream<Double> times, final double tickSize) {
this(times.mapToDouble(Double::doubleValue), tickSize, false);
}
/**
* Constructs a time discretization from a (non closed and not necessarily sorted) stream of boxed doubles.
*
* @param times A double stream of time points for the time discretization.
*/
public TimeDiscretizationFromArray(final Stream<Double> times) {
this(times.mapToDouble(Double::doubleValue), timeTickSizeDefault, false);
}