Skip to content

Instantly share code, notes, and snippets.

@sagarpatel288
Last active May 5, 2020 09:40
Show Gist options
  • Save sagarpatel288/1befa2159b6ed4571eb83137783fedfb to your computer and use it in GitHub Desktop.
Save sagarpatel288/1befa2159b6ed4571eb83137783fedfb to your computer and use it in GitHub Desktop.
Passing a function literal that has only one parameter (function literal syntax/ signature 2)
/**
* While calling the higher order function When the function type parameter is one and only parameter,
* and if the function type has also one and only parameter,
* in addition to function call parentheses, we can also omit the parameter of the function type and an arrow ```->```
* We just write core business logic between curly braces
* and we can access our single parameter through the keyword it like below:
*/
doSomething { "$it" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment