Print

Print


Can you show some sample code of how you add the field to the class/subsclass of GPIndividual, and what is the setter/getter like? My current guess is that when you used that field in some static method and followed the intelligence prompt and made the field static.

On Tue, 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.