commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Carman <ja...@carmanconsulting.com>
Subject Re: svn commit: r983137 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ArrayUtils.java
Date Sun, 08 Aug 2010 20:28:59 GMT
On Sun, Aug 8, 2010 at 1:25 PM, sebb <sebbaz@gmail.com> wrote:
>
> As it stands, the code allows calls of the form:
>
> Map<Integer,Integer> map = ArrayUtils.toMap(new String[][] {{"foo",
> "bar"}, {"hello", "world"}});
>
> without complaining.
>
> Failing to check the types of the array entries on creation means that
> the error may lie undetected until much later, making it potentially
> much harder to debug.
>

I am not against checking against the type arguments, but this change
assumes the user won't do something stupid.  It'd be a
ClassCastException later, yes.  Having the type arguments only allows
the user not to have to cast the return type.  They can use type
inference.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message