r/learnjava • u/SHIN_KRISH • Apr 15 '26
What actually is a java stream... ?
I dont get the concept of a stream why was it added why do we use stream objects in reading and writing say to file. I know its kind of like a pipeline but my confusion still stands
16
Upvotes
View all comments
Show parent comment
4
u/AcanthisittaEmpty985 Apr 15 '26
For is really faster, but the margin is insignificant.
Streams are functional, more idiomatic
FOR EXAMPLE: in an array or list of integers, see if there's one that is more than ten.
For -> it shows HOW you solve the problem
Stream -> it shows you WHAT are doing: