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


Java LongStream.of方法代码示例

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


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

示例1: arrayToStream

import java.util.stream.LongStream; //导入方法依赖的package包/类
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();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:ArrayStreamLinkerExporter.java

示例2: longProvider

import java.util.stream.LongStream; //导入方法依赖的package包/类
static LongStream longProvider() {
    return LongStream.of(4L, 5L);
}
 
开发者ID:bonigarcia,项目名称:mastering-junit5,代码行数:4,代码来源:MethodSourcePrimitiveTypesParameterizedTest.java

示例3: stream

import java.util.stream.LongStream; //导入方法依赖的package包/类
@NonNull
@Override
default LongStream stream() {
  return LongStream.of(this.x(), this.y());
}
 
开发者ID:KyoriPowered,项目名称:math,代码行数:6,代码来源:Vector2l.java

示例4: stream

import java.util.stream.LongStream; //导入方法依赖的package包/类
@NonNull
@Override
default LongStream stream() {
  return LongStream.of(this.x(), this.y(), this.z(), this.w());
}
 
开发者ID:KyoriPowered,项目名称:math,代码行数:6,代码来源:Vector4l.java

示例5: stream

import java.util.stream.LongStream; //导入方法依赖的package包/类
@NonNull
@Override
default LongStream stream() {
  return LongStream.of(this.x(), this.y(), this.z());
}
 
开发者ID:KyoriPowered,项目名称:math,代码行数:6,代码来源:Vector3l.java

示例6: stream

import java.util.stream.LongStream; //导入方法依赖的package包/类
/**
 * If a value is present, returns a sequential {@link LongStream} containing
 * only that value, otherwise returns an empty {@code LongStream}.
 *
 * @apiNote
 * This method can be used to transform a {@code Stream} of optional longs
 * to an {@code LongStream} of present longs:
 * <pre>{@code
 *     Stream<OptionalLong> os = ..
 *     LongStream s = os.flatMapToLong(OptionalLong::stream)
 * }</pre>
 *
 * @return the optional value as an {@code LongStream}
 * @since 9
 */
public LongStream stream() {
    if (isPresent) {
        return LongStream.of(value);
    } else {
        return LongStream.empty();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:OptionalLong.java

示例7: stream

import java.util.stream.LongStream; //导入方法依赖的package包/类
/**
 * If a value is present in {@code optional}, returns a stream containing only that element,
 * otherwise returns an empty stream.
 *
 * <p><b>Java 9 users:</b> use {@code optional.stream()} instead.
 */
public static LongStream stream(OptionalLong optional) {
  return optional.isPresent() ? LongStream.of(optional.getAsLong()) : LongStream.empty();
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:10,代码来源:Streams.java


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