java.util.stream.DoubleStream#of ( )源码实例Demo

下面列出了java.util.stream.DoubleStream#of ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: latexdraw   文件: DoubleSupplier.java
@Override
public List<PotentialAssignment> getValueSources(final ParameterSignature sig) {
	final DoubleData doubledata = sig.getAnnotation(DoubleData.class);
	DoubleStream stream = Arrays.stream(doubledata.vals());

	if(doubledata.angle()) {
		stream = DoubleStream.of(0d, Math.PI / 2d, Math.PI, 3d * Math.PI / 2d, 2d * Math.PI, -Math.PI / 2d, -Math.PI,
			-3d * Math.PI / 2d, -2d * Math.PI, 1.234, -1.234, 3d * Math.PI, -3d * Math.PI);
	}

	if(doubledata.bads()) {
		stream = DoubleStream.concat(stream, DoubleStream.of(Double.NaN, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY));
	}

	return stream.mapToObj(i -> PotentialAssignment.forValue("", i)).collect(Collectors.toList());
}
 
源代码2 项目: openjdk-jdk9   文件: ArrayStreamLinkerExporter.java
public static Object arrayToStream(final Object array) {
    if (array instanceof int[]) {
        return IntStream.of((int[])array);
    } else if (array instanceof long[]) {
        return LongStream.of((long[])array);
    } else if (array instanceof double[]) {
        return DoubleStream.of((double[])array);
    } else if (array instanceof Object[]) {
        return Stream.of((Object[])array);
    } else {
        throw new IllegalArgumentException();
    }
}
 
源代码3 项目: groovy   文件: PluginDefaultGroovyMethods.java
/**
 * If a value is present in the {@link OptionalDouble}, returns a {@link DoubleStream}
 * with the value as its source or else an empty stream.
 *
 * @since 3.0.0
 */
public static DoubleStream stream(final OptionalDouble self) {
    if (!self.isPresent()) {
        return DoubleStream.empty();
    }
    return DoubleStream.of(self.getAsDouble());
}
 
源代码4 项目: FXyzLib   文件: Palette.java
public DoubleStream getTextureLocation(int iPoint){
    if(width==0 || height==0){
        return DoubleStream.of(0f,0f);
    }
    int y = iPoint/width; 
    int x = iPoint-width*y;
    // add 0.5 to interpolate colors from the middle of the pixel
    return DoubleStream.of((((float)x+0.5f)/((float)width)),(((float)y+0.5f)/((float)height)));
}
 
static DoubleStream doubleProvider() {
    return DoubleStream.of(2d, 3d);
}
 
static DoubleStream doubleProvider() {
    return DoubleStream.of(2d, 3d);
}
 
@Override
public DoubleIterator getUidxVs(int uidx) {
    return new StreamDoubleIterator(DoubleStream.of(1.0, 2.0, 3.0, 4.0, 5.0, 6.0));
}
 
@Override
public DoubleIterator getIidxVs(int iidx) {
    return new StreamDoubleIterator(DoubleStream.of(6.0, 5.0, 4.0, 3.0, 2.0));
}
 
源代码9 项目: paleo   文件: DoubleColumnTest.java
@Test
public void ofAllStream() {
    DoubleStream stream = DoubleStream.of(1, 2, 9, 0);
    DoubleColumn column = DoubleColumn.ofAll(ID, stream);
    assertMultipleValues(column);
}
 
源代码10 项目: redkale   文件: DoubleArraySimpledCoder.java
@Override
@SuppressWarnings("unchecked")
public DoubleStream convertFrom(R in) {
    double[] value = DoubleArraySimpledCoder.instance.convertFrom(in);
    return value == null ? null : DoubleStream.of(value);
}
 
源代码11 项目: cyclops   文件: MutableDouble.java
public DoubleStream toDoubleStream() {
    return DoubleStream.of(var);
}
 
源代码12 项目: Strata   文件: SparseLocalDateDoubleTimeSeries.java
@Override
public DoubleStream values() {
  return DoubleStream.of(values);
}
 
源代码13 项目: latexdraw   文件: DoubleSupplier.java
public static DoubleStream okDoubles() {
	return DoubleStream.of(-0.00001, -1.34, -83.12, 0d, 0.00001, 1.34, 83.12);
}
 
源代码14 项目: ApprovalTests.Java   文件: NumberUtils.java
public static DoubleStream toDoubleStream(double[] numbers)
{
  return DoubleStream.of(numbers);
}
 
源代码15 项目: Bytecoder   文件: OptionalDouble.java
/**
 * If a value is present, returns a sequential {@link DoubleStream}
 * containing only that value, otherwise returns an empty
 * {@code DoubleStream}.
 *
 * @apiNote
 * This method can be used to transform a {@code Stream} of optional doubles
 * to a {@code DoubleStream} of present doubles:
 * <pre>{@code
 *     Stream<OptionalDouble> os = ..
 *     DoubleStream s = os.flatMapToDouble(OptionalDouble::stream)
 * }</pre>
 *
 * @return the optional value as a {@code DoubleStream}
 * @since 9
 */
public DoubleStream stream() {
    if (isPresent) {
        return DoubleStream.of(value);
    } else {
        return DoubleStream.empty();
    }
}
 
源代码16 项目: openjdk-jdk9   文件: OptionalDouble.java
/**
 * If a value is present, returns a sequential {@link DoubleStream}
 * containing only that value, otherwise returns an empty
 * {@code DoubleStream}.
 *
 * @apiNote
 * This method can be used to transform a {@code Stream} of optional doubles
 * to a {@code DoubleStream} of present doubles:
 * <pre>{@code
 *     Stream<OptionalDouble> os = ..
 *     DoubleStream s = os.flatMapToDouble(OptionalDouble::stream)
 * }</pre>
 *
 * @return the optional value as a {@code DoubleStream}
 * @since 9
 */
public DoubleStream stream() {
    if (isPresent) {
        return DoubleStream.of(value);
    } else {
        return DoubleStream.empty();
    }
}
 
源代码17 项目: levelup-java-examples   文件: ConcatenateStream.java
@Test
public void join_doublestream_stream() {

	DoubleStream doubleStream1 = DoubleStream.of(9, 10);
	DoubleStream doubleStream2 = DoubleStream.of(11, 12);

	DoubleStream.concat(doubleStream1, doubleStream2).forEach(
			e -> System.out.println(e));

}
 
源代码18 项目: Strata   文件: DoubleArray.java
/**
 * Returns a stream over the array values.
 *
 * @return a stream over the values in the array
 */
public DoubleStream stream() {
  return DoubleStream.of(array);
}
 
源代码19 项目: finmath-lib   文件: TimeDiscretization.java
/**
 * Return a DoubleStream of this time discretization.
 *
 * @return The time discretization as <code>DoubleStream</code>
 */
default DoubleStream doubleStream() {
	return DoubleStream.of(getAsDoubleArray());
}
 
源代码20 项目: FXyzLib   文件: Point3D.java
public DoubleStream getCoordinates(float factor) { return DoubleStream.of(factor*x,factor*y,factor*z); }