Java Code Examples for java.util.stream.Stream#mapToDouble()

The following examples show how to use java.util.stream.Stream#mapToDouble() . These examples are extracted from open source projects. 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
private DoubleStream mapToDouble(Stream<NullableContainer<String>> stream) {
  // BUG: Diagnostic contains: dereferenced expression
  return stream.mapToDouble(c -> c.get().length());
}
 
Example 2
/**
 * 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);
}
 
Example 3
/**
 * 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);
}
 
Example 4
/**
 * 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);
}
 
Example 5
/**
 * 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);
}
 
Example 6
/**
 * 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);
}
 
Example 7
/**
 * 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);
}