Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while(cities!=null&&peopleList != null)
- {
- String[]citiesTokens=cities.split("; ");
- if(citiesTokens.length == 4)
- {
- String cityState=citiesTokens[0]+","+citiesTokens[1];
- String latLong=citiesTokens[2]+","+citiesTokens[3];
- hash.put(cityState, latLong);
- peopleLine.add(peopleList);
- }
- cities=brCities.readLine();
- peopleList=brPeopleList.readLine();
- }
- for(int i=0; i<peopleLine.size();i++)
- {
- String[]tokens=peopleLine.get(i).split(",");
- if(tokens.length ==4 || tokens.length ==5)
- {
- int x=-1;
- for(int j=0; j<states.size(); j++)
- {
- State s= states.get(j);
- if(s.getState().equals(tokens[3]))
- {
- x=j;
- break;
- }
- }
- if(x>=0)
- {
- State s=states.get(x);
- if(hash.containsKey(tokens[2]+","+tokens[3]))
- {
- String latLong= hash.get(tokens[2]+","+tokens[3]);
- s.addCity(tokens[2],latLong);
- s.addPeople(peopleLine.get(i));
- }
- }
- else
- {
- states.add(new State(tokens[2],tokens[3],peopleLine.get(i),hash.get(tokens[2]+","+tokens[3])));
- }
- }
- else
- {
- states.add(new State(tokens[2],tokens[3],peopleLine.get(i),hash.get(tokens[2]+","+tokens[3])));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement