java 8 - What are the differences between an aggregate operation and a method? -
..........
well, let me tell made mistakes: foreach() refering not aggregate operation method iteable. i've changed title of question , content.
my interest know if aggregate operation implemented default , can find implementation.
if want dig jdk sources can download them here @jbkm suggest. if have oracle jdk installed, there should src.zip
file in installation folder contains public sources. alternatively can check openjdk sources online, example, on grepcode. can see, implementation of foreach
iterable
quite simple:
default void foreach(consumer<? super t> action) { objects.requirenonnull(action); (t t : this) { action.accept(t); } }
if you're asking implementation of foreach
in stream api, it's more tricky thing should evaluate previous pipeline steps , perform operation in parallel parallel streams. can start investigation examining referencepipeline
class stream
implementation in openjdk.
Comments
Post a Comment