i have an array of states.....what happens is that i read in all these objects and many of them could be from the same state...but i just want to count each state once...
like if i have 3 people from iowa, 2 from new york and 3 from california, my states array will only have 3 elements in it, iowa, new york and california.....
i need the array to be exactly the size of the number of states, and nothing bigger or when i try to sort it, it will throw a null pointer exception....how can i count the number of states i will have....i have a different array that has the states and positions of records in them so i could use those somehow....
Question
lime
i have an array of states.....what happens is that i read in all these objects and many of them could be from the same state...but i just want to count each state once...
like if i have 3 people from iowa, 2 from new york and 3 from california, my states array will only have 3 elements in it, iowa, new york and california.....
i need the array to be exactly the size of the number of states, and nothing bigger or when i try to sort it, it will throw a null pointer exception....how can i count the number of states i will have....i have a different array that has the states and positions of records in them so i could use those somehow....
any ideas?
Link to comment
Share on other sites
3 answers to this question
Recommended Posts