Requiring at least one element in java variable argument list
问题 In this code construct: public MyClass(Integer... numbers) { do_something_with(numbers[]); } is it possible to require that numbers contains at least one entry in such a way, that this is checked at compile-time? (At run-time, of course, I can just check numbers.length.) Clearly I could do this: public MyClass(Integer number, Integer... more_numbers) { do_something_with(number, more_numbers[]); } but this isn't going to be very elegant. The reason I would like to do this is to make sure that