PeDuCKA
PeDuCKA

Reputation: 553

I do not understand how create hight order suspend function

What should the function look like? I would like create PageKeyDataSourceFactory.

class PageKeyDataSourceFactory(
    private var request: suspend (offset: Int) -> MutableList<Any>
)

Upvotes: 1

Views: 38

Answers (1)

Jens Baitinger
Jens Baitinger

Reputation: 2365

The function can be a suspend function. It must accept an Int as parameter and return a MutableList<Any>

var request: suspend (Int) -> ArrayList<Any>
    =  { offset: Int -> arrayListOf<Any>() }

Upvotes: 1

Related Questions