Intermediate operation and Terminal operation
Intermediate operation is a kind of Lazy one which doesn't do the work when no one is dependent/ watching on him. It means if no function is added after the intermediate operation function then if we try to print that one, It will not display anything but when any function is added after the intermediate operation then if we try to print, It will display the data.
Eg: filter() and map() in Stream API
Terminal operation is something like it doesn't bother who is watching or not watching. It will do the work even if no function is attached after it.
Eg: forEach() in Stream API/.
Comments
Post a Comment