Java Code Examples for java.util.stream.BaseStream#spliterator()

The following examples show how to use java.util.stream.BaseStream#spliterator() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConcatOpTest.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
void assertSized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertTrue(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertTrue(sp.estimateSize() < Long.MAX_VALUE);
}
 
Example 2
Source File: ConcatOpTest.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
void assertUnsized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertFalse(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertEquals(sp.estimateSize(), Long.MAX_VALUE);
}
 
Example 3
Source File: ConcatOpTest.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
void assertUnsized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertFalse(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertEquals(sp.estimateSize(), Long.MAX_VALUE);
}
 
Example 4
Source File: ConcatOpTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
void assertSized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertTrue(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertTrue(sp.estimateSize() < Long.MAX_VALUE);
}
 
Example 5
Source File: ConcatOpTest.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
void assertUnsized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertFalse(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertEquals(sp.estimateSize(), Long.MAX_VALUE);
}
 
Example 6
Source File: ConcatOpTest.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
void assertSized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertTrue(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertTrue(sp.estimateSize() < Long.MAX_VALUE);
}
 
Example 7
Source File: ConcatOpTest.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
void assertUnsized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertFalse(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertEquals(sp.estimateSize(), Long.MAX_VALUE);
}
 
Example 8
Source File: ConcatOpTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
void assertUnsized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertFalse(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertEquals(sp.estimateSize(), Long.MAX_VALUE);
}
 
Example 9
Source File: ConcatOpTest.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
void assertUnsized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertFalse(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertEquals(sp.estimateSize(), Long.MAX_VALUE);
}
 
Example 10
Source File: ConcatOpTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
void assertSized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertTrue(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertTrue(sp.estimateSize() < Long.MAX_VALUE);
}
 
Example 11
Source File: ConcatOpTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
void assertSized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertTrue(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertTrue(sp.estimateSize() < Long.MAX_VALUE);
}
 
Example 12
Source File: ConcatOpTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
void assertUnsized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertFalse(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertEquals(sp.estimateSize(), Long.MAX_VALUE);
}
 
Example 13
Source File: ConcatOpTest.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
void assertUnsized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertFalse(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertEquals(sp.estimateSize(), Long.MAX_VALUE);
}
 
Example 14
Source File: ConcatOpTest.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
void assertSized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertTrue(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertTrue(sp.estimateSize() < Long.MAX_VALUE);
}
 
Example 15
Source File: ConcatOpTest.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
void assertUnsized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertFalse(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertEquals(sp.estimateSize(), Long.MAX_VALUE);
}
 
Example 16
Source File: ConcatOpTest.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
void assertSized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertTrue(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertTrue(sp.estimateSize() < Long.MAX_VALUE);
}
 
Example 17
Source File: ConcatOpTest.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
void assertUnsized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertFalse(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertEquals(sp.estimateSize(), Long.MAX_VALUE);
}
 
Example 18
Source File: ConcatOpTest.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
void assertUnsized(BaseStream<?, ?> s) {
    Spliterator<?> sp = s.spliterator();

    assertFalse(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
    assertEquals(sp.estimateSize(), Long.MAX_VALUE);
}
 
Example 19
Source File: StreamEx.java    From streamex with Apache License 2.0 2 votes vote down vote up
/**
 * 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));
}
 
Example 20
Source File: StreamEx.java    From streamex with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new {@link EntryStream} which keys are elements of this stream
 * and values are the corresponding elements of 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 EntryStream#zip(List, List)} or
 * {@link EntryStream#zip(Object[], Object[])} 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 other the stream to zip this stream with
 * @return the new stream
 * @see #zipWith(BaseStream, BiFunction)
 * @since 0.6.7
 */
public <V> EntryStream<T, V> zipWith(BaseStream<V, ?> other) {
    return new EntryStream<>(new ZipSpliterator<>(spliterator(), other.spliterator(),
            SimpleImmutableEntry::new, true), context.combine(other));
}