Skip to content

Commit

Permalink
chore: 리뷰 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
Soundbar91 committed Nov 27, 2024
1 parent 4e15f2b commit 8630d82
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,24 @@ public static List<ClassInfo> of(String classTime, String classPlace) {
String[] classTimeSegment = classTime.substring(1, classTime.length() - 1).trim().split(",\\s*");

List<ClassInfo> classInfos = new ArrayList<>();
List<Integer> tempClassTimes = new ArrayList<>();
List<Integer> currentTimes = new ArrayList<>();
int index = 0;

for (String segment : classTimeSegment) {
int parseInt = Integer.parseInt(segment);
if (parseInt == -1) {
if (!tempClassTimes.isEmpty()) {
classInfos.add(new ClassInfo(new ArrayList<>(tempClassTimes), classPlaceSegment[index++]));
tempClassTimes.clear();
if (!currentTimes.isEmpty()) {
classInfos.add(new ClassInfo(new ArrayList<>(currentTimes), classPlaceSegment[index++]));
currentTimes.clear();
}
}
else {
tempClassTimes.add(parseInt);
currentTimes.add(parseInt);
}
}

if (!tempClassTimes.isEmpty()) {
classInfos.add(new ClassInfo(new ArrayList<>(tempClassTimes), classPlaceSegment[index]));
if (!currentTimes.isEmpty()) {
classInfos.add(new ClassInfo(new ArrayList<>(currentTimes), classPlaceSegment[index]));
}

return classInfos;
Expand Down

0 comments on commit 8630d82

Please sign in to comment.