outlying
12/06/2016, 3:37 PMfun categoryId(vararg ids: Int): Filter {
params.put("categoryId", listOf(ids))
return this
}
I would like to provide a bunch of this-a-like methods to other developers to make their work easier. Generally for Java developers, but writing return this
in each method feels messy. I thought a moment about solution and this came to me:
fun categoryId(vararg ids: Int): this = params.put("categoryId", listOf(ids))
Here I propose this as return type, in terms of functionality it will be equal to first piece of code.
This won’t be very useful within Kotlin only projects (apply) but for those writing in Kotlin for Java developers it might be useful, also this will reduce some code for builders.
What do you think ? Does it feels like good idea ?