i am writing a program where i will have a list of two objects, the first will be a string, and the second an integer.
list = ((string1, int1), (string2, int2) ... (stringN, intN))
i then have to go through the list of these two objects, look at intX, do some calculation on it, and depending on the result, put (stringX, intX) it into another list.
can someone please suggest to me what data structure would be best to use for (stringN, intN). I am just thinking of simply having a Vector for each (stringN, intN) i.e. have a list of Vectors, but maybe there is a better way?
You could create a little class consisting of just the two data members. That might have a little less overhead than using one of the container classes. (Then again, maybe not. I've never tried comparing the two approaches to see if there's a measurable difference, but it might make an interesting experiment.)
As Seetharaman suggested, paired values sounds like a Map -- but only if one of your elements (either the String or the int) can be used as a unique key for the pair. If that's not the case, then Kurt's suggestion of a special class makes sense.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org