Problem creating object


New member
Hi, everybody
I have a problem writing a service code:

objectInstance : Has a char atribute (character)
It is created before the iteration, when I do this, the atribute character has always the same value for all objects, it is not overwrite in every objectInstance.character = params.string.charAt(j)
It only works when I create the object inside the iteration, but this solution is too slow, because I must to create a lot of objects (more than 1000000).
I need to know if in Grails exist a way to use the same object for every iteration, just modifying it value.

My service code:
def getCharacter(params){

        def objectInstance= new Object()
        def array = []
		int a = 0
                for(int j =0; j<params.string.size();j++){
                     objectInstance.character = params.string.charAt(j)
                     array[a] = objectInstance   
        return array

My gsp code

	 <g:each in="${array}" status="i" var="a">
              <td> ${a.character}</td>			  

Character is always the same

Thank you very much