Skip to content

疑问 #3

@xixifeng

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的第三个参数并没有执行,若能举一个体现第三个参数作用的例子会更好.

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