Java Code Examples for java.util.stream.DoubleStream#of()
The following examples show how to use
java.util.stream.DoubleStream#of() .
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: DoubleSupplier.java From latexdraw with GNU General Public License v3.0 | 6 votes |
@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()); }
Example 2
Source File: ArrayStreamLinkerExporter.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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(); } }
Example 3
Source File: Palette.java From FXyzLib with GNU General Public License v3.0 | 5 votes |
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))); }
Example 4
Source File: PluginDefaultGroovyMethods.java From groovy with Apache License 2.0 | 5 votes |
/** * 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()); }
Example 5
Source File: MutableDouble.java From cyclops with Apache License 2.0 | 4 votes |
public DoubleStream toDoubleStream() { return DoubleStream.of(var); }
Example 6
Source File: NumberUtils.java From ApprovalTests.Java with Apache License 2.0 | 4 votes |
public static DoubleStream toDoubleStream(double[] numbers) { return DoubleStream.of(numbers); }
Example 7
Source File: DoubleSupplier.java From latexdraw with GNU General Public License v3.0 | 4 votes |
public static DoubleStream okDoubles() { return DoubleStream.of(-0.00001, -1.34, -83.12, 0d, 0.00001, 1.34, 83.12); }
Example 8
Source File: SparseLocalDateDoubleTimeSeries.java From Strata with Apache License 2.0 | 4 votes |
@Override public DoubleStream values() { return DoubleStream.of(values); }
Example 9
Source File: MethodSourcePrimitiveTypesParameterizedTest.java From mastering-junit5 with Apache License 2.0 | 4 votes |
static DoubleStream doubleProvider() { return DoubleStream.of(2d, 3d); }
Example 10
Source File: DoubleArraySimpledCoder.java From redkale with Apache License 2.0 | 4 votes |
@Override @SuppressWarnings("unchecked") public DoubleStream convertFrom(R in) { double[] value = DoubleArraySimpledCoder.instance.convertFrom(in); return value == null ? null : DoubleStream.of(value); }
Example 11
Source File: DoubleColumnTest.java From paleo with Apache License 2.0 | 4 votes |
@Test public void ofAllStream() { DoubleStream stream = DoubleStream.of(1, 2, 9, 0); DoubleColumn column = DoubleColumn.ofAll(ID, stream); assertMultipleValues(column); }
Example 12
Source File: IteratorsAbstractFastPreferenceDataTest.java From RankSys with Mozilla Public License 2.0 | 4 votes |
@Override public DoubleIterator getIidxVs(int iidx) { return new StreamDoubleIterator(DoubleStream.of(6.0, 5.0, 4.0, 3.0, 2.0)); }
Example 13
Source File: IteratorsAbstractFastPreferenceDataTest.java From RankSys with Mozilla Public License 2.0 | 4 votes |
@Override public DoubleIterator getUidxVs(int uidx) { return new StreamDoubleIterator(DoubleStream.of(1.0, 2.0, 3.0, 4.0, 5.0, 6.0)); }
Example 14
Source File: MethodSourcePrimitiveTypesParameterizedTest.java From Mastering-Software-Testing-with-JUnit-5 with MIT License | 4 votes |
static DoubleStream doubleProvider() { return DoubleStream.of(2d, 3d); }
Example 15
Source File: ConcatenateStream.java From levelup-java-examples with Apache License 2.0 | 3 votes |
@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)); }
Example 16
Source File: OptionalDouble.java From openjdk-jdk9 with GNU General Public License v2.0 | 3 votes |
/** * 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(); } }
Example 17
Source File: OptionalDouble.java From Bytecoder with Apache License 2.0 | 3 votes |
/** * 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(); } }
Example 18
Source File: DoubleArray.java From Strata with Apache License 2.0 | 2 votes |
/** * Returns a stream over the array values. * * @return a stream over the values in the array */ public DoubleStream stream() { return DoubleStream.of(array); }
Example 19
Source File: TimeDiscretization.java From finmath-lib with Apache License 2.0 | 2 votes |
/** * Return a DoubleStream of this time discretization. * * @return The time discretization as <code>DoubleStream</code> */ default DoubleStream doubleStream() { return DoubleStream.of(getAsDoubleArray()); }
Example 20
Source File: Point3D.java From FXyzLib with GNU General Public License v3.0 | votes |
public DoubleStream getCoordinates(float factor) { return DoubleStream.of(factor*x,factor*y,factor*z); }