[armedbear-devel] Using Java variable arguments

Alessio Stalla alessiostalla at gmail.com
Sun Jan 24 10:48:21 UTC 2010


On Sun, Jan 24, 2010 at 3:31 AM, Blake McBride <blake at mcbride.name> wrote:
>
> Java has had support for variable argument methods since version 5.
>  Wouldn't it be cleaner to use that?  For example, in LispObject.java there
> are several "execute" methods, one to support various numbers of arguments.
>  In Java 5+ you could write:
> public LispObject execute(LispObject ... arg)  {  whatever  }
> You call it like you do now, i.e.  execute(a, b, c, d)
> but arg gets an array of the arguments.

The reason for the existence of several overloads of the execute
method is probably to avoid the creation of an array in the first
place.

Alessio




More information about the armedbear-devel mailing list