Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- line=br.readLine();
- while(line != null)
- {
- String[]tokens = line.split(delim);
- if(tokens.length==4)
- {
- String[]tok=tokens[0].split(del);
- //START HERE
- if(!place.isEmpty())
- {
- //does this place exist?
- int x = -1;
- //loop through all places and do manual check for place name
- for(int i=0; i<place.size(); i++)
- {
- Place lugar = place.get(i);
- if(lugar.getState().equals(tokens[3]))
- {
- x = i;
- break;
- }
- }
- if(x>=0)
- {
- //it does exist, add the city and state to that place
- Place lugar = place.get(x);
- lugar.addCity(tokens[2]);
- lugar.addPeople(line);
- }
- else
- {
- place.add(new Place(tokens[2],tokens[3],line));
- }
- }
- else
- {
- place.add(new Place(tokens[2],tokens[3],line));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement