def sample = ['Groovy', 'Gradle', 'Grails', 'Spock'] as String[]
def result = sample.stream() // Use stream() on array objects
.filter { s -> s.startsWith('Gr') }
.map { s -> s.toUpperCase() }
.toList() // toList() added to Stream by Groovy
when the application hasn’t used lambda expressions before, even the framework for generating the lambda classes has to be loaded (Oracle’s current implementation uses ASM under the hood). This is the actual cause of the slowdown, loading and initialization of a dozen internally used classes, not the lambda expression itself.
K. Lake. (2004)cite arxiv:astro-ph/0404319
Comment: Final form to appear in Physical Review Letters. Further information
at http://grtensor.org/Robertson/.
F. Binard, и A. Felty. Late breaking paper at Genetic and Evolutionary
Computation Conference (GECCO'2007), стр. 2415--2422. London, United Kingdom, ACM Press, (7-11 July 2007)