java.util.stream.Stream.isParallel()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(1057)

本文整理了Java中java.util.stream.Stream.isParallel()方法的一些代码示例,展示了Stream.isParallel()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Stream.isParallel()方法的具体详情如下:
包路径:java.util.stream.Stream
类名称:Stream
方法名:isParallel

Stream.isParallel介绍

暂无

代码示例

代码示例来源:origin: speedment/speedment

/**
 * Returns whether this stream, if a terminal operation were to be executed,
 * would execute in parallel.  Calling this method after invoking an
 * terminal stream operation method may yield unpredictable results.
 *
 * @return {@code true} if this stream would execute in parallel if executed
 */
@Override
public boolean isParallel() {
  return inner.isParallel();
}

代码示例来源:origin: google/guava

checkNotNull(consumer);
if (streamA.isParallel() || streamB.isParallel()) {
 zip(streamA, streamB, TemporaryPair::new).forEach(pair -> consumer.accept(pair.a, pair.b));
} else {

代码示例来源:origin: speedment/speedment

@Override
public boolean isParallel() {
  return stream().isParallel();
}

代码示例来源:origin: prestodb/presto

checkNotNull(consumer);
if (streamA.isParallel() || streamB.isParallel()) {
 zip(streamA, streamB, TemporaryPair::new).forEach(pair -> consumer.accept(pair.a, pair.b));
} else {

代码示例来源:origin: google/j2objc

checkNotNull(consumer);
if (streamA.isParallel() || streamB.isParallel()) {
 zip(streamA, streamB, TemporaryPair::new).forEach(pair -> consumer.accept(pair.a, pair.b));
} else {

代码示例来源:origin: KronicDeth/intellij-elixir

private static <T, R> Stream<R> withIndex(Stream<T> stream, FunctionWithIndex<T, R> function) {
  assert !stream.isParallel();
  final Iterator<T> iterator = stream.iterator();
  final Iterator<R> returnIterator = new Iterator<R>() {
    private int index = 0;
    @Override
    public boolean hasNext() {
      return iterator.hasNext();
    }
    @Override
    public R next() {
      return function.apply(iterator.next(), index++);
    }
  };
  return iteratorToFiniteStream(returnIterator);
}

代码示例来源:origin: wildfly/wildfly

checkNotNull(consumer);
if (streamA.isParallel() || streamB.isParallel()) {
 zip(streamA, streamB, TemporaryPair::new).forEach(pair -> consumer.accept(pair.a, pair.b));
} else {

代码示例来源:origin: google/guava

new ImmutableList.Builder<>(streams.length);
for (Stream<? extends T> stream : streams) {
 isParallel |= stream.isParallel();
 Spliterator<? extends T> splitr = stream.spliterator();
 splitrsBuilder.add(splitr);

代码示例来源:origin: google/guava

checkNotNull(streamB);
checkNotNull(function);
boolean isParallel = streamA.isParallel() || streamB.isParallel(); // same as Stream.concat
Spliterator<A> splitrA = streamA.spliterator();
Spliterator<B> splitrB = streamB.spliterator();

代码示例来源:origin: google/guava

checkNotNull(stream);
checkNotNull(function);
boolean isParallel = stream.isParallel();
Spliterator<T> fromSpliterator = stream.spliterator();

代码示例来源:origin: google/j2objc

new ImmutableList.Builder<>(streams.length);
for (Stream<? extends T> stream : streams) {
 isParallel |= stream.isParallel();
 Spliterator<? extends T> splitr = stream.spliterator();
 splitrsBuilder.add(splitr);

代码示例来源:origin: google/j2objc

checkNotNull(streamB);
checkNotNull(function);
boolean isParallel = streamA.isParallel() || streamB.isParallel(); // same as Stream.concat
Spliterator<A> splitrA = streamA.spliterator();
Spliterator<B> splitrB = streamB.spliterator();

代码示例来源:origin: wildfly/wildfly

new ImmutableList.Builder<>(streams.length);
for (Stream<? extends T> stream : streams) {
 isParallel |= stream.isParallel();
 Spliterator<? extends T> splitr = stream.spliterator();
 splitrsBuilder.add(splitr);

代码示例来源:origin: wildfly/wildfly

checkNotNull(streamB);
checkNotNull(function);
boolean isParallel = streamA.isParallel() || streamB.isParallel(); // same as Stream.concat
Spliterator<A> splitrA = streamA.spliterator();
Spliterator<B> splitrB = streamB.spliterator();

代码示例来源:origin: google/j2objc

checkNotNull(stream);
checkNotNull(function);
boolean isParallel = stream.isParallel();
Spliterator<T> fromSpliterator = stream.spliterator();

代码示例来源:origin: wildfly/wildfly

checkNotNull(stream);
checkNotNull(function);
boolean isParallel = stream.isParallel();
Spliterator<T> fromSpliterator = stream.spliterator();

代码示例来源:origin: prestodb/presto

checkNotNull(streamB);
checkNotNull(function);
boolean isParallel = streamA.isParallel() || streamB.isParallel(); // same as Stream.concat
Spliterator<A> splitrA = streamA.spliterator();
Spliterator<B> splitrB = streamB.spliterator();

代码示例来源:origin: prestodb/presto

checkNotNull(stream);
checkNotNull(function);
boolean isParallel = stream.isParallel();
Spliterator<T> fromSpliterator = stream.spliterator();

代码示例来源:origin: prestodb/presto

new ImmutableList.Builder<>(streams.length);
for (Stream<? extends T> stream : streams) {
 isParallel |= stream.isParallel();
 Spliterator<? extends T> splitr = stream.spliterator();
 splitrsBuilder.add(splitr);

代码示例来源:origin: aol/cyclops

public final static <T> Stream<Seq<T>> groupedByTime(final Stream<T> stream, final long time, final TimeUnit t) {
  return StreamSupport.stream(new GroupedByTimeSpliterator(stream.spliterator(),()->Seq.fromIterable(new ArrayList<>()),
      Function.identity(),time,t),stream.isParallel());
}
@Deprecated

相关文章