Sorry about the formatting glitches, trying again:

val m = Map(1->"a",2->"b",3->"c")
val field = m(1).getClass.getDeclaredField("value")
field.setAccessible(true)
val mods = field.getClass.getDeclaredField("modifiers")
mods.setAccessible(true)
mods.setInt(field, field.getModifiers & ~java.lang.reflect.Modifier.FINAL)
field.set(m(1), field.get(m(2)))
println(m)
// => Map(1 -> b, 2 -> b, 3 -> c)

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to