O'Reilly logo

Pragmatic Scala by Venkat Subramaniam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Ultimately Lazy Streams

Placing a lazy view on a strict collection doesn’t change the collection; it helps delay executing operations to the last possible moment. In other words, with a lazy view the values may all be in there; you simply won’t process them urgently or eagerly. A Stream is lazy to the bone—it produces values only on demand.

That may sound odd at first and may raise a number of questions: how many values would it hold, when does it create it, how do we get the values? A stream may be finite or infinite—that’s right, an infinite series. Wait a minute, if it is infinite in size, then how could we possibly store it on our machines, with the limited amount of memory we have? Well, now you know what this cloud computing is all ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required