jastrachan | 27 Feb 10:24 2004
Picon

map() method changes - collect is probably a better name

While chatting on #groovy I was using the map method example...

     [1, 2, 3].map { it * 2 }
     -> [2, 4, 6]

and dain found this surprising. As I was typing it suddenly the use of 
the word 'map' made me feel a little uneasy as it mentally means 
java.util.Map in most Java developers minds.

So I'm thinking before 1.0 we should consider following the ruby / 
smalltalk convention of using 'collect' for this method...

     [1, 2, 3].collect { it * 2 }
     -> [2, 4, 6]

But preserving the map method to create a map of key-value pairs. e.g.

     [1, 2, 3].map { it * 2 }
     -> [1:2, 2:4, 3:6]

If folks are OK with this I'll create an issue for it.

James
-------
http://radio.weblogs.com/0112098/

Gmane