Java Code Examples for java.util.Spliterator#SUBSIZED

The following examples show how to use java.util.Spliterator#SUBSIZED . 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: StreamSpliterators.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public final int characteristics() {
    init();

    // Get the characteristics from the pipeline
    int c = StreamOpFlag.toCharacteristics(StreamOpFlag.toStreamFlags(ph.getStreamAndOpFlags()));

    // Mask off the size and uniform characteristics and replace with
    // those of the spliterator
    // Note that a non-uniform spliterator can change from something
    // with an exact size to an estimate for a sub-split, for example
    // with HashSet where the size is known at the top level spliterator
    // but for sub-splits only an estimate is known
    if ((c & Spliterator.SIZED) != 0) {
        c &= ~(Spliterator.SIZED | Spliterator.SUBSIZED);
        c |= (spliterator.characteristics() & (Spliterator.SIZED | Spliterator.SUBSIZED));
    }

    return c;
}
 
Example 2
Source File: ArrayDeque8Test.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Spliterator characteristics are as advertised
 */
public void testSpliterator_characteristics() {
    ArrayDeque q = new ArrayDeque();
    Spliterator s = q.spliterator();
    int characteristics = s.characteristics();
    int required = Spliterator.NONNULL
        | Spliterator.ORDERED
        | Spliterator.SIZED
        | Spliterator.SUBSIZED;
    assertEquals(required, characteristics & required);
    assertTrue(s.hasCharacteristics(required));
    assertEquals(0, characteristics
                 & (Spliterator.CONCURRENT
                    | Spliterator.DISTINCT
                    | Spliterator.IMMUTABLE
                    | Spliterator.SORTED));
}
 
Example 3
Source File: StreamSpliterators.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public final int characteristics() {
    init();

    // Get the characteristics from the pipeline
    int c = StreamOpFlag.toCharacteristics(StreamOpFlag.toStreamFlags(ph.getStreamAndOpFlags()));

    // Mask off the size and uniform characteristics and replace with
    // those of the spliterator
    // Note that a non-uniform spliterator can change from something
    // with an exact size to an estimate for a sub-split, for example
    // with HashSet where the size is known at the top level spliterator
    // but for sub-splits only an estimate is known
    if ((c & Spliterator.SIZED) != 0) {
        c &= ~(Spliterator.SIZED | Spliterator.SUBSIZED);
        c |= (spliterator.characteristics() & (Spliterator.SIZED | Spliterator.SUBSIZED));
    }

    return c;
}
 
Example 4
Source File: Streams.java    From desugar_jdk_libs with GNU General Public License v2.0 5 votes vote down vote up
@Override
public int characteristics() {
    if (beforeSplit) {
        // Concatenation loses DISTINCT and SORTED characteristics
        return aSpliterator.characteristics() & bSpliterator.characteristics()
               & ~(Spliterator.DISTINCT | Spliterator.SORTED
                   | (unsized ? Spliterator.SIZED | Spliterator.SUBSIZED : 0));
    }
    else {
        return bSpliterator.characteristics();
    }
}
 
Example 5
Source File: Streams.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
@Override
public int characteristics() {
    if (beforeSplit) {
        // Concatenation loses DISTINCT and SORTED characteristics
        return aSpliterator.characteristics() & bSpliterator.characteristics()
               & ~(Spliterator.DISTINCT | Spliterator.SORTED
                   | (unsized ? Spliterator.SIZED | Spliterator.SUBSIZED : 0));
    }
    else {
        return bSpliterator.characteristics();
    }
}
 
Example 6
Source File: Streams.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public int characteristics() {
    if (beforeSplit) {
        // Concatenation loses DISTINCT and SORTED characteristics
        return aSpliterator.characteristics() & bSpliterator.characteristics()
               & ~(Spliterator.DISTINCT | Spliterator.SORTED
                   | (unsized ? Spliterator.SIZED | Spliterator.SUBSIZED : 0));
    }
    else {
        return bSpliterator.characteristics();
    }
}
 
Example 7
Source File: ThreadLocalRandom.java    From desugar_jdk_libs with GNU General Public License v2.0 4 votes vote down vote up
public int characteristics() {
    return (Spliterator.SIZED | Spliterator.SUBSIZED |
            Spliterator.NONNULL | Spliterator.IMMUTABLE);
}
 
Example 8
Source File: Streams.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public int characteristics() {
    return Spliterator.SIZED | Spliterator.SUBSIZED |
           Spliterator.ORDERED | Spliterator.IMMUTABLE;
}
 
Example 9
Source File: SplittableRandomTest.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public int characteristics() {
    return (Spliterator.SIZED | Spliterator.SUBSIZED |
            Spliterator.NONNULL | Spliterator.IMMUTABLE);
}
 
Example 10
Source File: StreamSpliterators.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
public int characteristics() {
    return (s.characteristics() & ~(Spliterator.SIZED | Spliterator.SUBSIZED |
                                    Spliterator.SORTED | Spliterator.ORDERED))
           | Spliterator.DISTINCT;
}
 
Example 11
Source File: Streams.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
public int characteristics() {
    return Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED |
           Spliterator.IMMUTABLE | Spliterator.NONNULL |
           Spliterator.DISTINCT | Spliterator.SORTED;
}
 
Example 12
Source File: ThreadLocalRandom.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public int characteristics() {
    return (Spliterator.SIZED | Spliterator.SUBSIZED |
            Spliterator.NONNULL | Spliterator.IMMUTABLE);
}
 
Example 13
Source File: WhileOps.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
@Override
public int characteristics() {
    // Size is not known
    return s.characteristics() & ~(Spliterator.SIZED | Spliterator.SUBSIZED);
}
 
Example 14
Source File: StreamSpliterators.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
@Override
public int characteristics() {
    return (s.characteristics() & ~(Spliterator.SIZED | Spliterator.SUBSIZED |
                                    Spliterator.SORTED | Spliterator.ORDERED))
           | Spliterator.DISTINCT;
}
 
Example 15
Source File: StreamSpliterators.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
@Override
public int characteristics() {
    return (s.characteristics() & ~(Spliterator.SIZED | Spliterator.SUBSIZED |
                                    Spliterator.SORTED | Spliterator.ORDERED))
           | Spliterator.DISTINCT;
}
 
Example 16
Source File: StreamSpliterators.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public final int characteristics() {
    return s.characteristics() &
           ~(Spliterator.SIZED | Spliterator.SUBSIZED | Spliterator.ORDERED);
}
 
Example 17
Source File: ThreadLocalRandom.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public int characteristics() {
    return (Spliterator.SIZED | Spliterator.SUBSIZED |
            Spliterator.NONNULL | Spliterator.IMMUTABLE);
}
 
Example 18
Source File: ThreadLocalRandom.java    From desugar_jdk_libs with GNU General Public License v2.0 4 votes vote down vote up
public int characteristics() {
    return (Spliterator.SIZED | Spliterator.SUBSIZED |
            Spliterator.NONNULL | Spliterator.IMMUTABLE);
}
 
Example 19
Source File: Streams.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public int characteristics() {
    return Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED |
           Spliterator.IMMUTABLE | Spliterator.NONNULL |
           Spliterator.DISTINCT | Spliterator.SORTED;
}
 
Example 20
Source File: SplittableRandomTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public int characteristics() {
    return (Spliterator.SIZED | Spliterator.SUBSIZED |
            Spliterator.NONNULL | Spliterator.IMMUTABLE);
}