-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[문자열 덧셈 계산기] 심규선 미션 제출합니다. #3
base: main
Are you sure you want to change the base?
Conversation
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import 목록 정리 한번 하시면 좋을 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확인했습니다 😊
커스텀 구분자에 숫자가 들어갔을 때 예외처리나 계산이 진행되도록 해야될 것 같아요 |
private boolean isCustomDelimiter = false; | ||
|
||
public void extractCustomDelimiter(String input) { | ||
if(input.startsWith("//") && input.substring(3,5).equals("\\n")){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
서비스에서 지속적으로 사용되는 상수들을 final
이나 enum
으로 관리하는 것이 요구사항이 바뀌더라도 쉽게 변경할 수 있어 좋을 것 같아요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enum을 적용하면 나중에 유지보수하기 편할거 같네요 !!
|
||
public class Extractor { | ||
|
||
private List<Character> delimiters = new ArrayList<>(Arrays.asList(',', ':')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delimiters
객체가 외부의 개입으로 변경될 가능성이 있을 것 같아요.
final
로 변경하거나 다른 방식으로 처리하는 것이 좋아보입니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좋은 의견 감사합니다 👏
} | ||
} | ||
|
||
public void extractNumbers(String input, List<Long> numbers) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
input
과 numbers
를 외부에서 받아 해당 객체에 값을 추가하는 것 같은데,
현재 방식은 데이터 무결성 및 일관성을 저해하고 있는 방법인 것 같아요.
외부에서 값을 받아 이 메서드 내부에서 리스트를 직접 생성해 반환하는 로직이 더 안전한 방법일 것 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
참고하겠습니다 👍
📁 디렉토리 구조
🛠️ 구현한 기능