SortingNearlySortedPrimitive.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:openjdk-jdk10 作者:
@DataProvider(name = "shapes")
public Object[][] createShapes() {
    Stream<List<Object>> baseCases = Stream.of(
            List.of("hiZeroLowTest", (IntFunction<int[]>) this::hiZeroLowData),
            List.of("endLessThanTest", (IntFunction<int[]>) this::endLessThanData),
            List.of("highFlatLowTest", (IntFunction<int[]>) this::highFlatLowData),
            List.of("identicalTest", (IntFunction<int[]>) this::identicalData),
            List.of("sortedReversedSortedTest", (IntFunction<int[]>) this::sortedReversedSortedData),
            List.of("pairFlipTest", (IntFunction<int[]>) this::pairFlipData),
            List.of("zeroHiTest", (IntFunction<int[]>) this::zeroHiData)
    );

    // Ensure the following inequality holds for certain sizes
    // DualPivotQuicksort.QUICKSORT_THRESHOLD <= size - 1
    //   < DualPivotQuicksort.COUNTING_SORT_THRESHOLD_FOR_SHORT_OR_CHAR
    // This guarantees that code paths are taken for checking nearly sorted
    // arrays for all primitive types
    List<Integer> sizes = List.of(100, 1_000, 10_000, 1_000_000);
    return baseCases.
            flatMap(l -> sizes.stream().map(s -> append(l, s))).
            toArray(Object[][]::new);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号