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


Java Spliterator.SORTED属性代码示例

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


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

示例1: assertMapCharacteristics

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());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:SpliteratorCharacteristics.java

示例2: characteristics

@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();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:Streams.java

示例3: assertSetCharacteristics

void assertSetCharacteristics(Set<Integer> s, int keyCharacteristics) {
    initSet(s);

    assertCharacteristics(s, keyCharacteristics);

    if ((keyCharacteristics & Spliterator.SORTED) == 0) {
        assertISEComparator(s);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:SpliteratorCharacteristics.java

示例4: characteristics

public int characteristics() {
    return (side == 0 ? Spliterator.SIZED : 0) |
            Spliterator.DISTINCT | Spliterator.SORTED | Spliterator.ORDERED;
}
 
开发者ID:dmcmanam,项目名称:bbst-showdown,代码行数:4,代码来源:TreeMapBST.java

示例5: characteristics

public int characteristics() {
    return Spliterator.DISTINCT | Spliterator.ORDERED |
        Spliterator.SORTED;
}
 
开发者ID:dmcmanam,项目名称:bbst-showdown,代码行数:4,代码来源:TreeMapRedBlack.java

示例6: characteristics

public int characteristics() {
    return Spliterator.DISTINCT | Spliterator.SORTED |
        Spliterator.ORDERED | Spliterator.CONCURRENT |
        Spliterator.NONNULL;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:5,代码来源:ConcurrentSkipListMap.java

示例7: characteristics

@Override
public int characteristics() {
    return (s.characteristics() & ~(Spliterator.SIZED | Spliterator.SUBSIZED |
                                    Spliterator.SORTED | Spliterator.ORDERED))
           | Spliterator.DISTINCT;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:6,代码来源:StreamSpliterators.java

示例8: filter

/** Returns a {@code Spliterator} filtered by the specified predicate. */
static <T> Spliterator<T> filter(Spliterator<T> fromSpliterator, Predicate<? super T> predicate) {
  checkNotNull(fromSpliterator);
  checkNotNull(predicate);
  class Splitr implements Spliterator<T>, Consumer<T> {
    T holder = null;

    @Override
    public void accept(T t) {
      this.holder = t;
    }

    @Override
    public boolean tryAdvance(Consumer<? super T> action) {
      while (fromSpliterator.tryAdvance(this)) {
        try {
          if (predicate.test(holder)) {
            action.accept(holder);
            return true;
          }
        } finally {
          holder = null;
        }
      }
      return false;
    }

    @Override
    public Spliterator<T> trySplit() {
      Spliterator<T> fromSplit = fromSpliterator.trySplit();
      return (fromSplit == null) ? null : filter(fromSplit, predicate);
    }

    @Override
    public long estimateSize() {
      return fromSpliterator.estimateSize() / 2;
    }

    @Override
    public Comparator<? super T> getComparator() {
      return fromSpliterator.getComparator();
    }

    @Override
    public int characteristics() {
      return fromSpliterator.characteristics()
          & (Spliterator.DISTINCT
              | Spliterator.NONNULL
              | Spliterator.ORDERED
              | Spliterator.SORTED);
    }
  }
  return new Splitr();
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:54,代码来源:CollectSpliterators.java

示例9: fromCharacteristics

/**
 * 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;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:StreamOpFlag.java


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