[ 
https://issues.apache.org/jira/browse/LANG-336?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12498797
 ] 

Tom Nichols commented on LANG-336:
----------------------------------

Henri Yandell [24/May/07 12:35 PM]
"what parts of Lang would benefit from varargs"

Parts wherever you will have one or more parameter of the same type.  Probably 
places where you currently pass in a String[] or Object[].  The reason being 
that previously, if you only had one parameter, you had to do 
foo( new Object[] { bar } );

If the method signature uses var args you can now pass an array OR 
foo( bar ); //or foo( bar, baz );

String.format( String s, Object... args )  is a classic example of its 
usefulness.

Another thing to consider is with var args *I believe* you will _always_ get an 
array instance passed in, whereas before you might have to do a null check:
foo( Object[] bar ) {
  if( bar == null ) throw new IllegalArgumentException( ... );
}

foo( Object... bar ) {
  for( Object o : bar ) // bar will never be null.
}

> Finally start using generics.
> -----------------------------
>
>                 Key: LANG-336
>                 URL: https://issues.apache.org/jira/browse/LANG-336
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.3
>            Reporter: Hendrik Maryns
>         Attachments: commons-lang-2.3-sources-generic.tar.gz, lang.patch
>
>
> It is obvious that the Jakarta  project is reluctant in starting to use the 
> 'new' (how old is it by now?) generics feature of Java.  Nevertheless some 
> other people would like to see it incorporated in the commons projects.
> I adapted commons Lang to usee generics.  Took me about an afternoon.  Would 
> be nice if something is done with it, except for only me using it in my 
> projects.
> Some stuff will have to be changed to conform to guidelines and stuff.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to