I have a files of zipcode, cities, and states. I need to create a class to store these items. The objects will be stored in a binary search tree so I need only one entry per city, state combination. Since some cities have multiple zipcodes, I have been asked to store the zip codes in a list within the class.
basic structure:
public class Places(String city, String state, String zip){
. . .
}
I believe I need to create the LinkedList within the class and then add the zip too it, but when I do so I am getting a null pointer exception.
//create new LinkedList in Place
LinkedList<String> zips = new LinkedList<String>();
zips.add(zip);
I have found plenty of information about adding objects to lists, but not using lists within objects.