So I have this \"list\" of ints. It could be a Vector, int[], List, whatever.
My goal though is to sort the
Why don't you simply cast those values to String within the original for loop, creating a String array rather than an int array? Assuming that you're gathering your initial integer from a starting point and adding to it on each for loop iteration, the following is a simple methodology to create a String array rather than an int array. If you need both int and String arrays with the same values in them, create them both in the same for loop and be done with it.
yourInt = someNumber;
for (int a = 0; a < aLimit; a ++) {
String stringName = String.valueOf(yourInt);
StringArrayName[a] = stringName;
yourInt ++;
}
Or, if you need both:
yourInt = someNumber;
for (int a = 0; a < aLimit; a ++) {
String stringName = String.valueOf(yourInt);
StringArrayName[a] = stringName;
intArrayName[a] = yourInt;
yourInt ++;
}
I agree with everyone else. For loops are easy to construct, require almost no overhead to run, and are easy to follow when reading code. Elegance in simplicity!