java.util.stream.Stream
2021-05-16 00:24 Spiderman25 阅读(113) 评论(0) 收藏 举报public abstract boolean allMatch(Predicate arg0)//所有为真,返回真
public abstract boolean anyMatch(Predicate arg0)//任一个为真,返回真
public static Builder builder()//流构造器,Stream.Builder<String> builder = Stream.builder(); builder.add("Production"); Stream<String> stream = builder.build();
public abstract Object collect(Supplier arg0,BiConsumer arg1,BiConsumer arg2)
public abstract Object collect(Collector arg0)//聚集操作
public static Stream concat(Stream arg0,Stream arg1)//合并两个流
public abstract long count()//数量
public abstract Stream distinct()//去重,元素实现equals和hasCode
public static Stream empty()//返回空的流
public abstract Stream filter(Predicate arg0)//过滤器
public abstract Optional findAny()//随机返回一个,一般是第一个,如果是并行流就不一定是第一个
public abstract Optional findFirst()//返回第一个元素
public abstract Stream flatMap(Function arg0)//把元素拆解成流,所有元素的流形成一条流
public abstract DoubleStream flatMapToDouble(Function arg0)//返回的是double流
public abstract IntStream flatMapToInt(Function arg0)//返回的是int流
public abstract LongStream flatMapToLong(Function arg0)//返回的是long流
public abstract void forEach(Consumer arg0)//遍历
public abstract void forEachOrdered(Consumer arg0)//保持顺序的遍历,并行流中也能保持顺序
public static Stream generate(Supplier arg0)//使用这个工厂无限生成流,可用limit来限制数量,常用来产生数个随机数
public static Stream iterate(Object arg0,UnaryOperator arg1)//无限产生流,把前面的返回值放到下一个参数中,可用limit来限制数量,Stream.iterate(new Student("小明", 22),x->{x.setAge(x.getAge()+2);return x;}).forEach(System.out::println);
public abstract Stream limit(long arg0)//限取几个
public abstract Stream map(Function arg0)//变换成别一种类型
public abstract DoubleStream mapToDouble(ToDoubleFunction arg0)//变换成double
public abstract IntStream mapToInt(ToIntFunction arg0)//变换成int
public abstract LongStream mapToLong(ToLongFunction arg0)//变换成long
public abstract Optional max(Comparator arg0)//获取最大值
public abstract Optional min(Comparator arg0)//获取最小值
public abstract boolean noneMatch(Predicate arg0)//所有为假,返回真
public static Stream of(Object arg0)//构造中一个流
public static transient Stream of(Object[] arg0)//构造中一个流
public abstract Stream peek(Consumer arg0)//遍历可修改,再返回流
public abstract Optional reduce(BinaryOperator arg0)//例有值ABCD,把AB代入function后得出的结果Z作为下个fucntion的第一个参数,第二个参数为C,即ZC,如此下去,详见:https://blog.csdn.net/icarusliu/article/details/79504602
public abstract Object reduce(Object arg0,BiFunction arg1,BinaryOperator arg2)//arg0为初始参数,充当arg1中的第一个参数,arg2为并行时最终结果的合并
public abstract Object reduce(Object arg0,BinaryOperator arg1)//arg0为初始参数,充当arg1中的第一个参数
public abstract Stream skip(long arg0)//跳过数量
public abstract Stream sorted(Comparator arg0)//排序
public abstract Stream sorted()//排序,元素实现Compareble即可
public abstract Object[] toArray(IntFunction arg0)//转换成数组,参数为产生数组的工厂
public abstract Object[] toArray()//转换成数组
public abstract boolean allMatch(Predicate<? super T> arg0)
public abstract boolean anyMatch(Predicate<? super T> arg0)
public static <T> Stream$Builder<T> builder()
public abstract <R,A> R collect(Collector<? super T, A, R> arg0)
public abstract <R> R collect(Supplier<R> arg0,BiConsumer<R, ? super T> arg1,BiConsumer<R, R> arg2)
public static <T> Stream<T> concat(Stream<? extends T> arg0,Stream<? extends T> arg1)
public abstract long count()
public abstract Stream<T> distinct()
public static <T> Stream<T> empty()
public abstract Stream<T> filter(Predicate<? super T> arg0)
public abstract Optional<T> findAny()
public abstract Optional<T> findFirst()
public abstract <R> Stream<R> flatMap(Function<? super T, ? extends Stream<? extends R>> arg0)
public abstract DoubleStream flatMapToDouble(Function<? super T, ? extends DoubleStream> arg0)
public abstract IntStream flatMapToInt(Function<? super T, ? extends IntStream> arg0)
public abstract LongStream flatMapToLong(Function<? super T, ? extends LongStream> arg0)
public abstract void forEach(Consumer<? super T> arg0)
public abstract void forEachOrdered(Consumer<? super T> arg0)
public static <T> Stream<T> generate(Supplier<T> arg0)
public static <T> Stream<T> iterate(T arg0,UnaryOperator<T> arg1)
public abstract Stream<T> limit(long arg0)
public abstract <R> Stream<R> map(Function<? super T, ? extends R> arg0)
public abstract DoubleStream mapToDouble(ToDoubleFunction<? super T> arg0)
public abstract IntStream mapToInt(ToIntFunction<? super T> arg0)
public abstract LongStream mapToLong(ToLongFunction<? super T> arg0)
public abstract Optional<T> max(Comparator<? super T> arg0)
public abstract Optional<T> min(Comparator<? super T> arg0)
public abstract boolean noneMatch(Predicate<? super T> arg0)
public static <T> Stream<T> of()
public static <T> Stream<T> of(T arg0)
public abstract Stream<T> peek(Consumer<? super T> arg0)
public abstract <U> U reduce(U arg0,BiFunction<U, ? super T, U> arg1,BinaryOperator<U> arg2)
public abstract Optional<T> reduce(BinaryOperator<T> arg0)
public abstract T reduce(T arg0,BinaryOperator<T> arg1)
public abstract Stream<T> skip(long arg0)
public abstract Stream<T> sorted()
public abstract Stream<T> sorted(Comparator<? super T> arg0)
public abstract <A> A[] toArray(IntFunction<A[]> arg0)
public abstract Object[] toArray()
浙公网安备 33010602011771号