Streams { public static <C> Function<C, Stream<C>> toIntervalBest(final Comparator<? super C> comparator, final int size) { requireNonNull(comparator); return sliceBest((a, b) -> best(comparator, a, b), size); } private  Streams(); static Function<C, Stream<C>> toStrictlyIncreasing(); static Function<C, Stream<C>> toStrictlyDecreasing(); static Function<T, Stream<T>> toStrictlyImproving(final Comparator<? super T> comparator); static Function<C, Stream<C>> toIntervalMax(final int size); static Function<C, Stream<C>> toIntervalMin(final int size); static Function<C, Stream<C>> toIntervalBest(final Comparator<? super C> comparator, final int size); static Function<C, Stream<C>> toIntervalMax(final Duration timespan); static Function<C, Stream<C>> toIntervalMax(final Duration timespan, final Clock clock); static Function<C, Stream<C>> toIntervalMin(final Duration timespan); static Function<C, Stream<C>> toIntervalMin(final Duration timespan, final Clock clock); static Function<C, Stream<C>> toIntervalBest(final Comparator<? super C> comparator, final Duration timespan); static Function<C, Stream<C>> toIntervalBest(
		final Comparator<? super C> comparator,
		final Duration timespan,
		final Clock clock
	);  }
@Test(dataProvider = "toIntervalBestData") public void toIntervalBest(final int streamSize, final int sliceSize) { final ISeq<Integer> values = IntStream.range(0, streamSize).boxed() .flatMap(Streams.toIntervalBest(Comparator.reverseOrder(), sliceSize)) .collect(ISeq.toISeq()); for (int i = 0; i < streamSize/sliceSize; ++i) { Assert.assertEquals(values.get(i).intValue(), sliceSize*i); } }