Robert

55%
Flag icon
Don't retrofit every method that has a final array parameter; use varargs only when a call really operates on a variable-length sequence of values.
Robert
Perhaps a clearer/simpler way to say this: When the number of parameters varies at compile time from one call to another.
Jeremy liked this
Brian
· Flag
Brian
but i think the variable-length 'sequence' part is important. you can argue that default values can result in number of parameters varying from call to call, but that's not a varargs case.
Robert
· Flag
Robert
The part I'm trying to point out — proposing a different way to explain what's here — is that varargs are appropriate to consider when the number of values a _developer_ might provide varies from case…
Effective Java: A Programming Language Guide (Java Series)
Rate this book
Clear rating
Open Preview