I have method with 10+ parameters actually I should write it with builder pattern. However, I think it will be a mess when converted to Kotlin. I wonder if there is a way to write java that could easily act like Kotlin does?
When we created fun with Kotlin like this
fun foo(bar: Int = 0, baz: Int) { /* ... */ }
foo(baz = 1) // The default value bar = 0 is used
How can we write similar method in java without written every possible?
E.g.
don't need to write
void foo(int bar, int baz){
...
}
void foo(int baz){
int bar = 0;
}
No comments:
Post a Comment