Do people really use Scala's Stream class in production code, or is it primarily of academic interest?
Noun. codestream (plural codestreams) (computing) A stream of code. The codestream obtained after compression of an image with JPEG 2000 is scalable in nature, meaning that it can be decoded in a number of ways.
A stream consists of source followed by zero or more intermediate methods combined together (pipelined) and a terminal method to process the objects obtained from the source as per the methods described. Stream is used to compute elements as per the pipelined methods without altering the original value of the object.
A stream is a flow of data from a program to a backing store, or from a backing store to a program. The program can either write to a stream, or read from a stream. Reading from and writing to a stream. Streams and stream processing.
A stream is an object which accepts sequences of characters. It is a destination of data which can be thought of much like an output stream in C++ or an ANSI C-file stream for writing data to a disk or another peripheral device.
There's no problem with Stream
, except when people use it to replace Iterator
-- as opposed to replacing List
, which is the collection most similar to it. In that particular case, one has to be careful in its use. On the other hand, one has to be careful using Iterator
as well, since each element can only be iterated through once.
So, since both have their own problems, why single out Stream
's? I daresay it's simply that people are used to Iterator
from Java, whereas Stream
is a functional thing.
Even though I wrote that Iterator is what I want to use nearly all the time I do use Stream
in production code. I just don't automatically assume that the cells are garbage collected.
Sometimes Stream
fits the problem perfectly. I think the api gives some good examples where recursion is involved...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With