当前位置: 首页>>代码示例>>Java>>正文


Java StreamSupport.longStream方法代码示例

本文整理汇总了Java中java8.util.stream.StreamSupport.longStream方法的典型用法代码示例。如果您正苦于以下问题:Java StreamSupport.longStream方法的具体用法?Java StreamSupport.longStream怎么用?Java StreamSupport.longStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java8.util.stream.StreamSupport的用法示例。


在下文中一共展示了StreamSupport.longStream方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: longs

import java8.util.stream.StreamSupport; //导入方法依赖的package包/类
/**
 * Returns a stream producing the given {@code streamSize} number of
 * pseudorandom {@code long} values.
 *
 * @param streamSize the number of values to generate
 * @return a stream of pseudorandom {@code long} values
 * @throws IllegalArgumentException if {@code streamSize} is
 *         less than zero
 * @since 1.8
 */
public LongStream longs(long streamSize) {
    if (streamSize < 0L)
        throw new IllegalArgumentException(BAD_SIZE);
    return StreamSupport.longStream
        (new RandomLongsSpliterator
         (0L, streamSize, Long.MAX_VALUE, 0L),
         false);
}
 
开发者ID:streamsupport,项目名称:streamsupport,代码行数:19,代码来源:ThreadLocalRandom.java

示例2: longs

import java8.util.stream.StreamSupport; //导入方法依赖的package包/类
/**
 * Returns a stream producing the given {@code streamSize} number
 * of pseudorandom {@code long} values from this generator and/or
 * one split from it.
 *
 * @param streamSize the number of values to generate
 * @return a stream of pseudorandom {@code long} values
 * @throws IllegalArgumentException if {@code streamSize} is
 *         less than zero
 */
public LongStream longs(long streamSize) {
    if (streamSize < 0L)
        throw new IllegalArgumentException(BAD_SIZE);
    return StreamSupport.longStream
        (new RandomLongsSpliterator
         (this, 0L, streamSize, Long.MAX_VALUE, 0L),
         false);
}
 
开发者ID:streamsupport,项目名称:streamsupport,代码行数:19,代码来源:SplittableRandom.java

示例3: stream

import java8.util.stream.StreamSupport; //导入方法依赖的package包/类
/**
 * Returns a sequential {@link LongStream} 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 LongStream} 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 LongStream stream(long[] array, int startInclusive, int endExclusive) {
    return StreamSupport.longStream(spliterator(array, startInclusive, endExclusive), false);
}
 
开发者ID:streamsupport,项目名称:streamsupport,代码行数:18,代码来源:J8Arrays.java


注:本文中的java8.util.stream.StreamSupport.longStream方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。