by We will show a simple use case of requesting a list of urls and summing the response bodies’ lengths and how the use or absence of lambdas may result in a concurrent or sequential computing .
To perform asynchronous HTTP requests in Java we may use the java 11 HttpClient, which is also available for Kotlin.
We may start by the use of the asynchronous fetch() function to perform an HTTP get request and henceforward we may use the await to get the fulfilled value of the resulting promise.
To that end we need to use a coroutine builder that will run the given lambda in a new coroutine and returns a promise of its execution.