commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@gmail.com>
Subject Re: svn commit: r983137 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ArrayUtils.java
Date Mon, 09 Aug 2010 15:47:53 GMT

On Aug 9, 2010, at 7:08 AM, James Carman wrote:

> On Mon, Aug 9, 2010 at 7:32 AM, sebb <sebbaz@gmail.com> wrote:
>> Why not split the code into two methods:
>> 
>> public static <K,V> Map<K, V> toMap(Map.Entry<K,V>[] array)
>> and
>> public static <K,V> Map<K, V> toMap(Class<K> keyType, Class<V>
>> valueType, Object[][] array)
>> 
>> Both methods can be made type-safe.
>> 
> 
> Well, we did just bump the version number, so we are free to do
> something like that I guess.  Anyone else have any thoughts on the
> subject (are you even paying attention anymore)?
> 

In the spirit of the Map.Entry variant of the method, I would suggest eating our own lang3
dog food and providing:

public static <K, V> Map<K, V> toMap(Pair<K, V>... entries)

as well.  Pair.of("foo", "bar") is certainly a terser option than creating an anonymous implementation
of Map.Entry.

-Matt

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


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


Mime
View raw message