holgerbrandl
11/11/2017, 4:02 PMclass Foo(val nrow:Int){
val rowNumber: Iterable<Int> get() = 1..nrow
val rowNumber: Iterable<Int> by lazy { (1..nrow) }
}
The lazy will cache the result in a backing field, but the first impl using get won’t, is this correct?
If so, should I prefer lazy impl if the operation might be expensive and the rowNumber would be accessed multiple times?