Java Code Examples for java.util.Spliterator#SORTED

The following examples show how to use java.util.Spliterator#SORTED . 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: SpliteratorCharacteristics.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
void assertMapCharacteristics(Map<Integer, String> m, int keyCharacteristics, int notValueCharacteristics) {
    initMap(m);

    assertCharacteristics(m.keySet(), keyCharacteristics);

    assertCharacteristics(m.values(),
                          keyCharacteristics & ~(Spliterator.DISTINCT | notValueCharacteristics));

    assertCharacteristics(m.entrySet(), keyCharacteristics);

    if ((keyCharacteristics & Spliterator.SORTED) == 0) {
        assertISEComparator(m.keySet());
        assertISEComparator(m.values());
        assertISEComparator(m.entrySet());
    }
}
 
Example 2
Source File: SpliteratorCharacteristics.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
void assertMapCharacteristics(Map<Integer, String> m, int keyCharacteristics, int notValueCharacteristics) {
    initMap(m);

    assertCharacteristics(m.keySet(), keyCharacteristics);

    assertCharacteristics(m.values(),
                          keyCharacteristics & ~(Spliterator.DISTINCT | notValueCharacteristics));

    assertCharacteristics(m.entrySet(), keyCharacteristics);

    if ((keyCharacteristics & Spliterator.SORTED) == 0) {
        assertISEComparator(m.keySet());
        assertISEComparator(m.values());
        assertISEComparator(m.entrySet());
    }
}
 
Example 3
Source File: SpliteratorCharacteristics.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
void assertSetCharacteristics(Set<Integer> s, int keyCharacteristics) {
    initSet(s);

    assertCharacteristics(s, keyCharacteristics);

    if ((keyCharacteristics & Spliterator.SORTED) == 0) {
        assertISEComparator(s);
    }
}
 
Example 4
Source File: SpliteratorCharacteristics.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
void assertSetCharacteristics(Set<Integer> s, int keyCharacteristics) {
    initSet(s);

    assertCharacteristics(s, keyCharacteristics);

    if ((keyCharacteristics & Spliterator.SORTED) == 0) {
        assertISEComparator(s);
    }
}
 
Example 5
Source File: SpliteratorCharacteristics.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
void assertSetCharacteristics(Set<Integer> s, int keyCharacteristics) {
    initSet(s);

    assertCharacteristics(s, keyCharacteristics);

    if ((keyCharacteristics & Spliterator.SORTED) == 0) {
        assertISEComparator(s);
    }
}
 
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: Streams.java    From dragonwell8_jdk 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 8
Source File: ConcurrentSkipListMap.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public int characteristics() {
    return Spliterator.DISTINCT | Spliterator.SORTED |
        Spliterator.ORDERED | Spliterator.CONCURRENT |
        Spliterator.NONNULL;
}
 
Example 9
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 10
Source File: ConcurrentSkipListMap.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public int characteristics() {
    return Spliterator.DISTINCT | Spliterator.SORTED |
        Spliterator.ORDERED | Spliterator.CONCURRENT |
        Spliterator.NONNULL;
}
 
Example 11
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 12
Source File: Streams.java    From Bytecoder with Apache License 2.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 13
Source File: StreamSpliterators.java    From dragonwell8_jdk 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 14
Source File: Streams.java    From JDKSourceCode1.8 with MIT License 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 15
Source File: ConcurrentSkipListMap.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public int characteristics() {
    return Spliterator.DISTINCT | Spliterator.SORTED |
        Spliterator.ORDERED | Spliterator.CONCURRENT |
        Spliterator.NONNULL;
}
 
Example 16
Source File: ConcurrentSkipListMap.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public int characteristics() {
    return Spliterator.DISTINCT | Spliterator.SORTED |
        Spliterator.ORDERED | Spliterator.CONCURRENT |
        Spliterator.NONNULL;
}
 
Example 17
Source File: ConcurrentSkipListMap.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public int characteristics() {
    return Spliterator.DISTINCT | Spliterator.ORDERED |
        Spliterator.SORTED;
}
 
Example 18
Source File: ConcurrentSkipListMap.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
public int characteristics() {
    return Spliterator.DISTINCT | Spliterator.ORDERED |
        Spliterator.SORTED;
}
 
Example 19
Source File: ConcurrentSkipListMap.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public int characteristics() {
    return Spliterator.DISTINCT | Spliterator.SORTED |
        Spliterator.ORDERED | Spliterator.CONCURRENT |
        Spliterator.NONNULL;
}
 
Example 20
Source File: StreamOpFlag.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Converts a spliterator characteristic bit set to stream flags.
 *
 * @implSpec
 * If the spliterator is naturally {@code SORTED} (the associated
 * {@code Comparator} is {@code null}) then the characteristic is converted
 * to the {@link #SORTED} flag, otherwise the characteristic is not
 * converted.
 *
 * @param spliterator the spliterator from which to obtain characteristic
 *        bit set.
 * @return the stream flags.
 */
static int fromCharacteristics(Spliterator<?> spliterator) {
    int characteristics = spliterator.characteristics();
    if ((characteristics & Spliterator.SORTED) != 0 && spliterator.getComparator() != null) {
        // Do not propagate the SORTED characteristic if it does not correspond
        // to a natural sort order
        return characteristics & SPLITERATOR_CHARACTERISTICS_MASK & ~Spliterator.SORTED;
    }
    else {
        return characteristics & SPLITERATOR_CHARACTERISTICS_MASK;
    }
}