Though you are not describing it fully, I think this is because you have forgotten how clone() works in this context. ECJ builds ONE individual. It then CLONES that individual to make MANY individuals for use later on. When an individual is cloned, its fields are copied. If the fields are numbers or booleans, their value is copied. If the fields are objects, their POINTER is copied, meaning that they are POINTING to the same exact object. In your case, the string pointer was copied, but then you just changed the string to a different string in one of the indivdiuals. However in the Map, the pointer was copied, but you're then not replacing the Map with another one but are rather probably just modifying the Map internally. It's still the SAME Map being referenced to by both individuals. You need to create a clone() method in your GPIndividual subclass which does this: 1. obj = super.clone() 2. obj.map = obj.map.clone() // however that's done for your Map object 3. return obj Sean On Mar 3, 2015, at 8:36 AM, nikima tomas <[log in to unmask]> wrote: > Hi, > > I am GP section of ECJ, and I am facing a strange problem. > > I added a new field to GPIndividual class to save some specific information for each individual. When I define this field as a simple one, for example a string, then every thing is fine and each individual has its own value for this field. However, when I define this field as a Map, then as soon as I fill in the field for one individual, other individuals in the population takes the same value. > Map<String, String> field = new HashMap<String, String>(); > > It is completely strange as I expect each individual has its own map, and changing value for an individual should not changed others. Please let me know how I can copy with this problem. > > regards, > NiKima.