Created
August 21, 2018 12:59
-
-
Save bergwerf/251be93f743fbe547505d502fdb73d43 to your computer and use it in GitHub Desktop.
Dart Iterable.where and Iterable.map lazyness test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
final data = new List.generate(100, (i) => i); | |
final result = data.where((i) { | |
print('where $i'); | |
return i > 0 && i % 10 == 0; | |
}).map((i) { | |
print('map $i'); | |
return i / 10; | |
}); | |
print('=========='); | |
print(result.first); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment