Fun exercise:

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), other.get(m(2)))

println(m)

// => Map(1 -> b, 2 -> b, 3 -> c)

2011/11/25 Cédric Beust ♔ <ced...@beust.com>:
>
>
> On Thu, Nov 24, 2011 at 5:11 PM, Kevin Wright <kev.lee.wri...@gmail.com>
> wrote:
>>
>> Otherwise, it's semantics.  method params are immutable
>
> Same as Java.
>
>>
>> unless, the standard keyword for values is "val"
>
> And "var" for variables, with Scala not encouraging either over the other.
>
>>
>> (equivalent to final in Java), and collections in the standard library
>
> They are collections, so irrelevant since we're talking about the language.
> Like I said, we already went through this.
> --
> Cédric
>
> --
> You received this message because you are subscribed to the Google Groups
> "The Java Posse" group.
> To post to this group, send email to javaposse@googlegroups.com.
> To unsubscribe from this group, send email to
> javaposse+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/javaposse?hl=en.
>

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

Reply via email to