/** * Returns an {@link IntStream} containing the elements of the first stream, followed by the * elements of the second stream, and so on. * * <p>This is equivalent to {@code Stream.of(streams).flatMapToInt(stream -> stream)}, but the * returned stream may perform better. * * @see IntStream#concat(IntStream, IntStream) */ public static IntStream concat(IntStream... streams) { // TODO(lowasser): optimize this later return Stream.of(streams).flatMapToInt(stream -> stream); }
@Override public Spliterator<T> spliterator() { return Stream.generate(() -> iterable).flatMap(Streams::stream).spliterator(); }
/** * Returns a {@link DoubleStream} containing the elements of the first stream, followed by the * elements of the second stream, and so on. * * <p>This is equivalent to {@code Stream.of(streams).flatMapToDouble(stream -> stream)}, but the * returned stream may perform better. * * @see DoubleStream#concat(DoubleStream, DoubleStream) */ public static DoubleStream concat(DoubleStream... streams) { // TODO(lowasser): optimize this later return Stream.of(streams).flatMapToDouble(stream -> stream); }
/** * Convert the supplied paths to a list of {@link Resource} handles using * the given {@link ResourceLoader}. * @param resourceLoader the {@code ResourceLoader} to use to convert the paths * @param paths the paths to be converted * @return a new list of resources * @since 4.2 * @see #convertToResources(ResourceLoader, String...) * @see #convertToClasspathResourcePaths */ public static List<Resource> convertToResourceList(ResourceLoader resourceLoader, String... paths) { return stream(resourceLoader, paths).collect(Collectors.toList()); }
/** * Returns a {@link LongStream} containing the elements of the first stream, followed by the * elements of the second stream, and so on. * * <p>This is equivalent to {@code Stream.of(streams).flatMapToLong(stream -> stream)}, but the * returned stream may perform better. * * @see LongStream#concat(LongStream, LongStream) */ public static LongStream concat(LongStream... streams) { // TODO(lowasser): optimize this later return Stream.of(streams).flatMapToLong(stream -> stream); }
private static Stream<Class<?>> testClasses() { // @formatter:off return Stream.of( AlwaysFailingBeforeTestClassTestCase.class, AlwaysFailingAfterTestClassTestCase.class, AlwaysFailingPrepareTestInstanceTestCase.class, AlwaysFailingBeforeTestMethodTestCase.class, AlwaysFailingBeforeTestExecutionTestCase.class, AlwaysFailingAfterTestExecutionTestCase.class, AlwaysFailingAfterTestMethodTestCase.class, FailingBeforeTransactionTestCase.class, FailingAfterTransactionTestCase.class); // @formatter:on }
/** * get routed invokers from result of script rule evaluation */ @SuppressWarnings("unchecked") protected <T> List<Invoker<T>> getRoutedInvokers(Object obj) { if (obj instanceof Invoker[]) { return Arrays.asList((Invoker<T>[]) obj); } else if (obj instanceof Object[]) { return Arrays.stream((Object[]) obj).map(item -> (Invoker<T>) item).collect(Collectors.toList()); } else { return (List<Invoker<T>>) obj; } }