while(StationPatternMatches.find()) {
String strPre = StationPatternMatches.group(1);
String strNext = StationPatternMatches.group(11);
Pattern stationNamePattern = Pattern.compile("(.+)>(.+)</a>/<a (.+)");
Matcher stationNameMatches = stationNamePattern.matcher(strNext);
if(stationNameMatches.find()) {
strpreStation = stationNameMatches.group(2).trim() + ", ";
}
stationNameMatches = stationNamePattern.matcher(strPre);
if(stationNameMatches.find()) {
strnextStation = stationNameMatches.group(2).trim() + ", ";
}
strpreStation += StationPatternMatches.group(2).replace("</a>", "");
strnextStation += StationPatternMatches.group(12).replace("</a>", "");
}
위의 while문 내용이 이해가 안됩니다.
중간에 if 문으로 strNext에서 매치되는 패턴을 찾아서 strpreStation에 대입하고
strPre에서 매치되는 패턴을 찾아서 strnextStation에 대입하는 이유가 뭐죠?
결과적으로는 이프문의 내용이 없어도 잘 실행이 될테고..
이유가 궁금합니다.
제가 아직 전체 맥락을 파악 못해서 그렇겠지만 아무리 봐도 이해가 잘 안되네요 ㅠ