I have a webservice that returns me a recordset. The record set looks something like this.
COUNTRYNAME STATEPROVINCE POPULATION
CANADA ALBERTA 2.7 million
CANADA NOVA SCOTIA 1.6 million
UNITED STATES PENNSYLVANIA 4.5 million
UNITED STATES NEW JERSEY 6.8 million
This has to be arranged in a type structure like this. struct statepop { string statename; string population; } struct country { string countryname; statepop statedata; }
Since I do not know the countries being fetched at any given point of time, I decided to create an arraylist of the country structure. I realize that I also need to create an array of states.
What is the quickest way of writing a single loop so that I can represent the record in an arraylist of country?