So to summarize:
- where we currently have a method that receives an array representing
parameters, this should be replaced at least by a varargs
Especially when you are providing a set of parameters to run a method
(this is the case when I want to pass in 3 values, for example, rather
than just one. And those set of parameters is only used in calling the
method; if the set is typically also used for other things then it
suggests a list.
and possibly overloaded to also accept a List
Nice addition.
- where we currently have a method that receives either an array
representing some other structure
I'm not sure what you mean by "some other structure"?
, or receives more than one array, then it should be replaced with a List
By this, you mean if you can't have two varargs? Again, I think it the
first point would apply to the current set that is used for multiple
parameter when actually writing the method call. The examples I can
think of are for helper methods where a set of arrays are constructed
before the method call. What I'd like to ensure is that in cases where
you are calling a method directly that you can list everything in the
method call without resorting to creating arrays or building lists, and
the vararg does that elegantly.
- where we have a method returning an array, this should be replaced
by a list (preferably immutable, but the Javadoc should indicate)
Definitely
Rob