Skip to content

疑问 #3

Description

@xixifeng
Stream<String> stream = Stream.of("I", "love", "you", "too");
List<String> list = stream.collect(ArrayList::new,ArrayList::add,(t,u)-> {
			System.out.println("t:" + t+" u:" + u);
			t.addAll(u);
});
System.out.println(list);

谢谢, 你启发(正反参半)了我.

这个例子,collect的第三个参数并没有执行,若能举一个体现第三个参数作用的例子会更好.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions