I got the above to work but it prints it out all on one line which I can fix. I have a distance method to find the distance between to inputted zip codes
public int distance (int zip1 , int...
Type: Posts; User: PeskyToaster
I got the above to work but it prints it out all on one line which I can fix. I have a distance method to find the distance between to inputted zip codes
public int distance (int zip1 , int...
I see that it skips right to null but I need to have it there somewhere. I know that I was missing an i++ to keep it going along the while loop. What should I return at the end and where in the loop?...
I now have
public ArrayList search(String str) {
ArrayList<ZipCode> searchList = new ArrayList<ZipCode>();
int i = 0;
while (i < list.size()) {
...
This is a different method from the first question. I posted the new method I needed help on, on the first page. It seems it is not adding the found Zip Codes to the array list
This code is supposed to search through the list of zip codes by city or state and add the ones that match to an arraylist then return that arraylist. So if I type in "new" it should return NEWARK...
It only returns two empty brackets []. I am just assuming that it is correctly finding the values and something is wrong with adding it into the searchList
When I commented out the null it worked correctly and found the right zip code. But I need to return null if the (int zip) that is inputted is not on the list of zip codes or isn't a valid response....
What do I need to do to fix this? I thought the i++ would send it through the for loop until it reaches list.size().
EDIT: By removing the null I can get it to search through the list and find...
Why is it only comparing to the first one?
I'm am testing out a method called
public ZipCode findZip (int zip) {
ZipCode p = new ZipCode(0);
for(int i = 0; i < list.size(); i++) {
if...
I am creating an Array List of zip codes (29000 of them) and I am having trouble getting it to add the complete zipcodes to the arrayList. I think my problem is actually using the ArrayList because...