learning scala view collection

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
原文地址:https://www.cnblogs.com/lianghong881018/p/11186957.html