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


Java BaseStream.spliterator方法代码示例

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


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

示例1: assertUnsized

import java.util.stream.BaseStream; //导入方法依赖的package包/类
void assertUnsized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertFalse(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertEquals(sp.estimateSize(), Long.MAX_VALUE);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:ConcatOpTest.java

示例2: assertSized

import java.util.stream.BaseStream; //导入方法依赖的package包/类
void assertSized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertTrue(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertTrue(sp.estimateSize() < Long.MAX_VALUE);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:ConcatOpTest.java

示例3: zipWith

import java.util.stream.BaseStream; //导入方法依赖的package包/类
/**
 * Creates a new {@link StreamEx} which is the result of applying of the
 * mapper {@code BiFunction} to the corresponding elements of this stream
 * and the supplied other stream. The resulting stream is ordered if both of
 * the input streams are ordered, and parallel if either of the input
 * streams is parallel. When the resulting stream is closed, the close
 * handlers for both input streams are invoked.
 *
 * <p>
 * This is a <a href="package-summary.html#StreamOps">quasi-intermediate
 * operation</a>.
 *
 * <p>
 * The resulting stream finishes when either of the input streams finish:
 * the rest of the longer stream is discarded. It's unspecified whether the
 * rest elements of the longer stream are actually consumed.
 *
 * <p>
 * The stream created by this operation may have poor characteristics and
 * parallelize badly, so it should be used only when there's no other
 * choice. If both input streams are random-access lists or arrays, consider
 * using {@link #zip(List, List, BiFunction)} or
 * {@link #zip(Object[], Object[], BiFunction)} respectively. If you want to
 * zip the stream with the stream of indices, consider using
 * {@link EntryStream#of(List)} instead.
 *
 * @param <V> the type of the other stream elements
 * @param <R> the type of the resulting stream elements
 * @param other the stream to zip this stream with
 * @param mapper a non-interfering, stateless function to apply to the
 *        corresponding pairs of this stream and other stream elements
 * @return the new stream
 * @since 0.6.7
 * @see #zipWith(BaseStream)
 */
public <V, R> StreamEx<R> zipWith(BaseStream<V, ?> other, BiFunction<? super T, ? super V, ? extends R> mapper) {
    return new StreamEx<>(new ZipSpliterator<>(spliterator(), other.spliterator(), mapper, true), context
            .combine(other));
}
 
开发者ID:amaembo,项目名称:streamex,代码行数:40,代码来源:StreamEx.java


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