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

The following examples show how to use java.util.stream.Stream#mapToDouble() . 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: NullAwayStreamSupportPositiveCases.java    From NullAway with MIT License 4 votes vote down vote up
private DoubleStream mapToDouble(Stream<NullableContainer<String>> stream) {
  // BUG: Diagnostic contains: dereferenced expression
  return stream.mapToDouble(c -> c.get().length());
}
 
Example 2
Source File: TimeDiscretizationFromArray.java    From finmath-lib with Apache License 2.0 2 votes vote down vote up
/**
 * 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
Source File: TimeDiscretizationFromArray.java    From finmath-lib with Apache License 2.0 2 votes vote down vote up
/**
 * 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
Source File: TimeDiscretizationFromArray.java    From finmath-lib with Apache License 2.0 2 votes vote down vote up
/**
 * 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
Source File: TimeDiscretizationFromArray.java    From finmath-lib with Apache License 2.0 2 votes vote down vote up
/**
 * 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
Source File: TimeDiscretizationFromArray.java    From finmath-lib with Apache License 2.0 2 votes vote down vote up
/**
 * 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
Source File: TimeDiscretizationFromArray.java    From finmath-lib with Apache License 2.0 2 votes vote down vote up
/**
 * 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);
}