I have 2 function for API connection:

```
//Load data from API
private fun loadData() {
    compositeDisposable.add(
        ApiClient.getClient.getQuestions(Params.getParamsSearch())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribeOn(Schedulers.io())
            .subscribe(this::handleResponse)
    )
}

//Response handler for API
private fun handleResponse(objectsQueryResult: ObjectsQueryResult) {
    updateAdapter(objectsQueryResult)

}

```

What is the syntax to put all lines in handleResponse function inside subscribe instead of using the function?

Something like this:

```
//Load data from API
private fun loadData() {
    compositeDisposable.add(
        ApiClient.getClient.getQuestions(Params.getParamsSearch())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribeOn(Schedulers.io())
            .subscribe({
updateAdapter(objectsQueryResult)
 })
    )
}

```
['https://Stackoverflow.com/questions/63593917', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1075753/']
```
.subscribe({ objectsQueryResult ->
    updateAdapter(objectsQueryResult)
})

```

or

```
.subscribe({
    updateAdapter(it)
})

```
```kotlin

//Load data from API
private fun loadData() {
    compositeDisposable.add(
        ApiClient.getClient.getQuestions(Params.getParamsSearch())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribeOn(Schedulers.io())
            .subscribe { objectsQueryResult -> updateAdapter(objectsQueryResult) }
    )
}

```

or

```kotlin

//Load data from API
private fun loadData() {
    compositeDisposable.add(
        ApiClient.getClient.getQuestions(Params.getParamsSearch())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribeOn(Schedulers.io())
            .subscribe { updateAdapter(it) }
    )
}

```