KT
kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
Lambda and Collections
Lambdas are very useful with collections and
in fact they are the backbone of the advanced
manipulation of collections.
map and filter
The basic function to manipulate collection is
'filter': this functions accepts as argument a
lambda and returns a new collection.
The lambda is given as argument an element of
the collection and returns a Boolean.
If the lambda returns true for an element,
that element is added to the new collection,
otherwise is excluded.
*/
/*
The function 'map' creates a new collection
created by applying the lambda supplied to
map to each element of the collection.
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run