RIP
Tutorial
Tags
Topics
Examples
eBooks
Tutorial by Examples
Lambda as parameter to filter function
val allowedUsers = users.filter { it.age > MINIMUM_AGE }
Lambda passed as a variable
val isOfAllowedAge = { user: User -> user.age > MINIMUM_AGE } val allowedUsers = users.filter(isOfAllowedAge)
Lambda for benchmarking a function call
General-purpose stopwatch for timing how long a function takes to run: object Benchmark { fun realtime(body: () -> Unit): Duration { val start = Instant.now() try { body() } finally { val end = Instant.now() return Duration.b...
Page 1 of 1
1
Cookie
This website stores cookies on your computer.
We use cookies to enhance your experience on our website and deliver personalized content.
For more details on our cookie usage, please review our
Cookie Policy
and
Privacy Policy
Accept all Cookies
Leave this website