Java Mailing List Archive

http://www.gg3721.com/

Home » user.groovy »

[groovy-user] Re: (correction) BUG(?) Map.putAt returns null

Barzilai Spinak

2010-03-08

Replies: Find Java Web Hosting

Author LoginPost Reply
oops
in the line where I wrote:
    assert (mymap['one']= '111' == '111')           // OK!

I should have written
    assert ((mymap['one']= '111') == '111')           // OK!

But the general bug with putAt remains

--
BBB
iPhone Games?  Need a challenge?
http://tridefense.com


On Mon, Mar 8, 2010 at 9:55 PM, Barzilai Spinak <barcho@creacion.com.uy> wrote:
According to:
http://groovy.codehaus.org/groovy-jdk/java/util/Map.html#putAt%28K,%20V%29

the putAt method of Map  "Returns:  the value corresponding to the given key"
(The putAt method supposedly supports the left-hand-side assignment with subscript operator)

However, in this code:

def mymap= [one:1]
assert (mymap['one']= '111' == '111')           // OK!
assert (mymap.putAt('one', '111') == '111')     // WRONG!
assert (mymap.putAt('one', '111') == null)      // putAt actually returs null!


This has been tested with Groovy 1.7.0 and 1.5.6 (the two version I have), so I guess it happens in all versions in between and has been happening for a long time.  Nobody cared?  Is it a bug in Groovy or a documentation error, or maybe I'm not interpreting things as I should?

--
BBB
iPhone Games?  Need a challenge?
http://tridefense.com

©2008 gg3721.com - Jax Systems, LLC, U.S.A.