Is there a way in java to declare a method argument, i.e. some kind of collection, but with a finite size?
For example, something like:
public Car(String colour, Wheel[4])
assuming that the car can be built with color and exactly 4 wheels. (Obviously, this specific example can be implemented by changing the method for listing through 4 wheels as separate parameters, but this does not scale)
It seems that similar restrictions should be expressed through method headings, but I just cannot think how Java will allow it.
source
share