Hi. When using java.util.stream 'map' method my opinion is that 'replaceWith' as method name would better describe what method do. 'map' method is applied on input stream, returns output stream but returned stream elements are return values from 'map' method Function argument. We continue our work with output stream so mapping with input stream have no meaning. Input stream is replaced with output stream which elements are outputs of Function. After that point we can forgot about input stream.
Example of usage: now - stream.map(e -> e+2).. // read: map input stream with output stream containing elements resulting from function (e -> e+2) proposed - stream.replaceWith(e -> e+2).. // read: replace input stream with output stream containing elements resulting from function (e -> e+2) With 'map' method number of elements is the same but we do not make assumptions what passed Function will do (specialization) until the moment we pass Function implementation as method argument.. I will appreciate any comments. Best regards, Krunoslav Magazin