當前位置: 首頁>>代碼示例>>Java>>正文


Java StreamSupport.doubleStream方法代碼示例

本文整理匯總了Java中java.util.stream.StreamSupport.doubleStream方法的典型用法代碼示例。如果您正苦於以下問題:Java StreamSupport.doubleStream方法的具體用法?Java StreamSupport.doubleStream怎麽用?Java StreamSupport.doubleStream使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.stream.StreamSupport的用法示例。


在下文中一共展示了StreamSupport.doubleStream方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doubles

import java.util.stream.StreamSupport; //導入方法依賴的package包/類
/**
 * Returns an effectively unlimited stream of pseudorandom {@code
 * double} values from this generator and/or one split from it; each value
 * conforms to the given origin (inclusive) and bound (exclusive).
 *
 * @implNote This method is implemented to be equivalent to {@code
 * doubles(Long.MAX_VALUE, randomNumberOrigin, randomNumberBound)}.
 *
 * @param randomNumberOrigin the origin (inclusive) of each random value
 * @param randomNumberBound the bound (exclusive) of each random value
 * @return a stream of pseudorandom {@code double} values,
 *         each with the given origin (inclusive) and bound (exclusive)
 * @throws IllegalArgumentException if {@code randomNumberOrigin}
 *         is greater than or equal to {@code randomNumberBound}
 */
public DoubleStream doubles(double randomNumberOrigin, double randomNumberBound) {
    if (!(randomNumberOrigin < randomNumberBound))
        throw new IllegalArgumentException(BadRange);
    return StreamSupport.doubleStream
        (new RandomDoublesSpliterator
         (this, 0L, Long.MAX_VALUE, randomNumberOrigin, randomNumberBound),
         false);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:24,代碼來源:SplittableRandom.java

示例2: doubles

import java.util.stream.StreamSupport; //導入方法依賴的package包/類
/**
 * Returns an effectively unlimited stream of pseudorandom {@code
 * double} values, each between zero (inclusive) and one
 * (exclusive).
 *
 * <p>A pseudorandom {@code double} value is generated as if it's the result
 * of calling the method {@link #nextDouble()}.
 *
 * @implNote This method is implemented to be equivalent to {@code
 * doubles(Long.MAX_VALUE)}.
 *
 * @return a stream of pseudorandom {@code double} values
 * @since 1.8
 */
public DoubleStream doubles() {
    return StreamSupport.doubleStream
            (new RandomDoublesSpliterator
                     (this, 0L, Long.MAX_VALUE, Double.MAX_VALUE, 0.0),
             false);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:21,代碼來源:Random.java

示例3: doubles

import java.util.stream.StreamSupport; //導入方法依賴的package包/類
/**
 * Returns a stream producing the given {@code streamSize} number of
 * pseudorandom {@code double} values, each between zero
 * (inclusive) and one (exclusive).
 *
 * @param streamSize the number of values to generate
 * @return a stream of {@code double} values
 * @throws IllegalArgumentException if {@code streamSize} is
 *         less than zero
 * @since 1.8
 */
public DoubleStream doubles(long streamSize) {
    if (streamSize < 0L)
        throw new IllegalArgumentException(BAD_SIZE);
    return StreamSupport.doubleStream
        (new RandomDoublesSpliterator
         (0L, streamSize, Double.MAX_VALUE, 0.0),
         false);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:20,代碼來源:ThreadLocalRandom.java

示例4: doubles

import java.util.stream.StreamSupport; //導入方法依賴的package包/類
/**
 * Returns a stream producing the given {@code streamSize} number of
 * pseudorandom {@code double} values, each between zero
 * (inclusive) and one (exclusive).
 *
 * @param streamSize the number of values to generate
 * @return a stream of {@code double} values
 * @throws IllegalArgumentException if {@code streamSize} is
 *         less than zero
 * @since 1.8
 */
public DoubleStream doubles(long streamSize) {
    if (streamSize < 0L)
        throw new IllegalArgumentException(BadSize);
    return StreamSupport.doubleStream
        (new RandomDoublesSpliterator
         (0L, streamSize, Double.MAX_VALUE, 0.0),
         false);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:20,代碼來源:ThreadLocalRandom.java

示例5: doubles

import java.util.stream.StreamSupport; //導入方法依賴的package包/類
/**
 * Returns an effectively unlimited stream of pseudorandom {@code
 * double} values from this generator and/or one split from it; each value
 * is between zero (inclusive) and one (exclusive).
 *
 * @implNote This method is implemented to be equivalent to {@code
 * doubles(Long.MAX_VALUE)}.
 *
 * @return a stream of pseudorandom {@code double} values
 */
public DoubleStream doubles() {
    return StreamSupport.doubleStream
        (new RandomDoublesSpliterator
         (this, 0L, Long.MAX_VALUE, Double.MAX_VALUE, 0.0),
         false);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:SplittableRandom.java

示例6: doubles

import java.util.stream.StreamSupport; //導入方法依賴的package包/類
/**
 * Returns a stream producing the given {@code streamSize} number of
 * pseudorandom {@code double} values, each conforming to the given origin
 * (inclusive) and bound (exclusive).
 *
 * <p>A pseudorandom {@code double} value is generated as if it's the result
 * of calling the following method with the origin and bound:
 * <pre> {@code
 * double nextDouble(double origin, double bound) {
 *   double r = nextDouble();
 *   r = r * (bound - origin) + origin;
 *   if (r >= bound) // correct for rounding
 *     r = Math.nextDown(bound);
 *   return r;
 * }}</pre>
 *
 * @param streamSize the number of values to generate
 * @param randomNumberOrigin the origin (inclusive) of each random value
 * @param randomNumberBound the bound (exclusive) of each random value
 * @return a stream of pseudorandom {@code double} values,
 *         each with the given origin (inclusive) and bound (exclusive)
 * @throws IllegalArgumentException if {@code streamSize} is
 *         less than zero
 * @throws IllegalArgumentException if {@code randomNumberOrigin}
 *         is greater than or equal to {@code randomNumberBound}
 * @since 1.8
 */
public DoubleStream doubles(long streamSize, double randomNumberOrigin,
                            double randomNumberBound) {
    if (streamSize < 0L)
        throw new IllegalArgumentException(BadSize);
    if (!(randomNumberOrigin < randomNumberBound))
        throw new IllegalArgumentException(BadRange);
    return StreamSupport.doubleStream
            (new RandomDoublesSpliterator
                     (this, 0L, streamSize, randomNumberOrigin, randomNumberBound),
             false);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:39,代碼來源:Random.java

示例7: doubles

import java.util.stream.StreamSupport; //導入方法依賴的package包/類
/**
 * Returns a stream producing the given {@code streamSize} number of
 * pseudorandom {@code double} values, each between zero
 * (inclusive) and one (exclusive).
 *
 * <p>A pseudorandom {@code double} value is generated as if it's the result
 * of calling the method {@link #nextDouble()}.
 *
 * @param streamSize the number of values to generate
 * @return a stream of {@code double} values
 * @throws IllegalArgumentException if {@code streamSize} is
 *         less than zero
 * @since 1.8
 */
public DoubleStream doubles(long streamSize) {
    if (streamSize < 0L)
        throw new IllegalArgumentException(BadSize);
    return StreamSupport.doubleStream
            (new RandomDoublesSpliterator
                     (this, 0L, streamSize, Double.MAX_VALUE, 0.0),
             false);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:23,代碼來源:Random.java

示例8: doubles

import java.util.stream.StreamSupport; //導入方法依賴的package包/類
/**
 * Returns an effectively unlimited stream of pseudorandom {@code
 * double} values, each conforming to the given origin (inclusive) and bound
 * (exclusive).
 *
 * @implNote This method is implemented to be equivalent to {@code
 * doubles(Long.MAX_VALUE, randomNumberOrigin, randomNumberBound)}.
 *
 * @param randomNumberOrigin the origin (inclusive) of each random value
 * @param randomNumberBound the bound (exclusive) of each random value
 * @return a stream of pseudorandom {@code double} values,
 *         each with the given origin (inclusive) and bound (exclusive)
 * @throws IllegalArgumentException if {@code randomNumberOrigin}
 *         is greater than or equal to {@code randomNumberBound}
 * @since 1.8
 */
public DoubleStream doubles(double randomNumberOrigin, double randomNumberBound) {
    if (!(randomNumberOrigin < randomNumberBound))
        throw new IllegalArgumentException(BadRange);
    return StreamSupport.doubleStream
        (new RandomDoublesSpliterator
         (0L, Long.MAX_VALUE, randomNumberOrigin, randomNumberBound),
         false);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:25,代碼來源:ThreadLocalRandom.java

示例9: stream

import java.util.stream.StreamSupport; //導入方法依賴的package包/類
/**
 * Returns a sequential {@link DoubleStream} with the specified range of the
 * specified array as its source.
 *
 * @param array the array, assumed to be unmodified during use
 * @param startInclusive the first index to cover, inclusive
 * @param endExclusive index immediately past the last index to cover
 * @return a {@code DoubleStream} for the array range
 * @throws ArrayIndexOutOfBoundsException if {@code startInclusive} is
 *         negative, {@code endExclusive} is less than
 *         {@code startInclusive}, or {@code endExclusive} is greater than
 *         the array size
 * @since 1.8
 */
public static DoubleStream stream(double[] array, int startInclusive, int endExclusive) {
    return StreamSupport.doubleStream(spliterator(array, startInclusive, endExclusive), false);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:18,代碼來源:Arrays.java


注:本文中的java.util.stream.StreamSupport.doubleStream方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。