...

/

LazyList: A Lazy Version of List

LazyList: A Lazy Version of List

In this lesson, you will be introduced to LazyLists; the lazy version of Lists.

Introduction

A LazyList is an immutable sequence type collection very similar to Lists. What makes a LazyList lazy is that it only computes required elements, allowing it to be infinitely long. Other than this difference, LazyLists have the same performance characteristics as Lists, hence, to avoid repetition, we won’t discuss them here.

Creating a LazyList

Similar to the :: method used for creating Lists, LazyLists are created with the ...