Skip to content

Conversation

@pq5910
Copy link
Contributor

@pq5910 pq5910 commented May 27, 2024

240528 김우정 0x04 풀이

Copy link
Collaborator

@heegane heegane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다 😎

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오늘 다시 말씀드리려고 했는데, buffer.write()는 데이터를 버퍼에 쓰는 메서드이고, 버퍼에 있는 데이터를 실제로 출력하는 메서드는 buffer.flush()입니다. BufferedWriter 객체의 close() 메서드를 호출하면, 스트림을 닫기 전에 자동으로 flush()가 호출됩니다. 따라서 flush()를 명시적으로 호출하지 않아도 스트림을 닫으면 남아있는 버퍼의 내용이 모두 출력 스트림으로 전송하게 된다고 합니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오오 좋은 정보 감사합니다! 이 내용에 대한 정보 추가로 더 알아볼게요:)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 if문으로 중첩해서 써서 코드가 다소 지저분해 보였는데, 우정님은 switch문 쓰셔서 코드의 가독성이 좋네요!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

입력값이 간단하면 StringTokenizer를 import해서 쓰기 보단 우정님처럼 input[0], input[1] 이렇게 접근해도 좋겠다는 생각이 드네요..🤔

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 ListIterator가 익숙하지 않아서 index로 접근하는 방식으로 풀었는데 확실히 ListIterator를 활용하는 게 성능상 좋을 것 같네요 🤣

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default문이라서 아래에 break가 필요할까? 하는 의문을 가졌는데, 검색해 보니까 코드의 가독성과 유지보수를 고려해서 의도적으로 다음 케이스로 넘어가지 않겠다는 명확한 신호를 주기 위해 break 문을 추가하는 경우도 있다고 하더라구요! 의도하신 걸까요?!

@heegane heegane self-assigned this May 28, 2024
@lee-JunR lee-JunR merged commit 746a9f3 into lee-JunR:main May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants