J
Jesper Sahner
Hi!
Is it possible to change a Character-object/StringBuffer-object
without creating a new Character-object/StringBuffer-object?
E.g. the following works fine:
ch1=new Character('A');
ch1=new Character(ch1.toLowerCase(ch1.charValue()));
However a new object ch1 is created, which shouldn't be necessary in
my opinion. If the "toLowerCase"-operation is performed many times in
a loop, it could be expensive with a new object created every time.
I imagine something like this pseudo-code should be possible:
ch1=new Character(); // create object
ch1.setValue('A'); // set value in existing object
ch1.toLowerCase(); // change existing object
My point is, that I want to create a Character-object once and for all
and then alter it, without having to re-create it all the time.
Regards,
Jesper
Is it possible to change a Character-object/StringBuffer-object
without creating a new Character-object/StringBuffer-object?
E.g. the following works fine:
ch1=new Character('A');
ch1=new Character(ch1.toLowerCase(ch1.charValue()));
However a new object ch1 is created, which shouldn't be necessary in
my opinion. If the "toLowerCase"-operation is performed many times in
a loop, it could be expensive with a new object created every time.
I imagine something like this pseudo-code should be possible:
ch1=new Character(); // create object
ch1.setValue('A'); // set value in existing object
ch1.toLowerCase(); // change existing object
My point is, that I want to create a Character-object once and for all
and then alter it, without having to re-create it all the time.
Regards,
Jesper