DEV Community

Discussion on: .map() vs .forEach()

Collapse
 
dergonokay profile image
DERGON • Edited

Also in java forEach is a terminal operation that closes the stream when it finishes. In the other hand, the map as in js it returns a new stream with the result of the mapping.