The view method will create a non-strict version of the collection which means that the elements of the collection will only be made available at access time.
val lazyLargeOddNumberList = (1 to 1000000).view.filter(_ % 2 != 0).take(10).toList
The view method will create a non-strict version of the collection which means that the elements of the collection will only be made available at access time.
val lazyLargeOddNumberList = (1 to 1000000).view.filter(_ % 2 != 0).take(10).toList