Hi Lucas, You're seeing what is known as "pass by reference". Basically, everything but primitive types (String, Number, Boolean, etc) get a reference to the original object passed, rather than a copy, when you do something like B = A. You might be able to use ObjectUtil.copy() to accomplish what you want, but I'm not sure off the top of my head.
I would also suggest searching the docs for "pass by reference" as its a fundamental concept you would be well served to thoroughly understand. HTH, Ben --- In [email protected], "Lucas Pereira" <[EMAIL PROTECTED]> wrote: > > Hi all. > Today I have this beginner question. > > If I create Object A of ArrayCollection for instance. > > And the create Object B also Array Collection, and Make B = A (it > safes a lot of time and code, specially when the other object is a > custom one). > > If I add an item to B, that item is also added to A. > > Other example. I have the class Guy with properties 1stName and 2ndName. > > If A is instance of Guy and B is also instance of Guy and I want it to > have the same 1stName has A is do B = A. > > Problem... If I make B.2ndName = "somename"... A object 2ndName also > changes to "somename". > > I don't want this!!! I only want B = A at the beginning and then I > want to be free to change be without changing A. > > How to get around this? > > Thanks > > And sorry for this silly question!!! >

