I have an API that has method which takes vararg of some object (fox example Param). I need to filter null params and not put it to vararg. Is it possible ?
I know there is a method in kotlin listOfNotNull
but api accepts vararg
(
This is example of calling API method (apiMethod(vararg params: Param)):
someFun() {
apiMethod(
Param("first"),
Param("second"),
null // need to filter it
)
}
P.S. I can't change apiMethod()