As a follow up to my question about j2me dynamic arrays,
I'm now trying to figure out a way to change the values of the Integers in my Vector.
Say I have a Vector v, and Array arr, and ints x, y and i;
In c++ I could do:
v[arr[x][y]] += i;
In j2me the best way I found so far to do the same is:
v.setElementAt(new Integer(((Integer)(v.elementAt(arr[x][y]))).intValue()+i), arr[x][y]);
Is this really the best way to do it j2me?
If it is, what went wrong here? Java is supposed to make me "do less work" and "do things for me" yet I find myself again and again doing extra work for it. Is something wrong with me, or is it some problem with Java?
Edit: I'm using the J2me SDK 3.0 which looks like it is Java 1.3 so no fancy generics and auto boxing and all that stuff.