Drew's Blog

The Joys of Technology Explored

C# "params" Keyword Equivalent Coming To Java... Kinda

Java SDK 1.5 (code named Tiger) is going to support variable length argument lists. In C#, this is accomplished via the params keyword. In Java, they are going to use an ellipsis token.

Posted by Keith Wedinger on Fri, June 6, 2003 @ 6:07AM

[sellsbrothers.com: Windows Developer News]

Yeah it's pretty lame because, as far as I can tell from reading the specification, you can't strongly type it. So it's always going to be an array of type Object as opposed to .NET where the params argument can be strongly typed.

Posted: Jun 06 2003, 12:56 PM by drub0y | with 1 comment(s)
Filed under:

Comments

Luke Hutteman said:

It's not even really a variable length argument list... from what I can read, instead of being able to do

object.method(a, b, x1, x2, x3);

you'd have to write

object.method(a, b, {x1, x2, x3});

which the compiler would simply translate to

object.method(a, b, new Object[]{x1, x2, x3});

so it's just a shorthand version of creating an Object-array; not really a variable length argument list.
# June 10, 2003 1:04 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)