Skip to content

Commit be181e5

Browse files
committed
메서드 추출 리팩토링
1 parent a2bfb8e commit be181e5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

number-baseball/src/main/java/io/github/gunkim/baseball/domain/BallNumbers.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public Result match(final BallNumbers otherBalls) {
1919
final BallNumber myBall = this.ballNumbers.get(i);
2020
final BallNumber otherBall = otherBalls.ballNumbers.get(i);
2121

22-
if (myBall.equals(otherBall)) {
22+
if (isSameBallNumber(myBall, otherBall)) {
2323
strike++;
2424
} else if (hasBallNumber(otherBall)) {
2525
ball++;
@@ -29,6 +29,10 @@ public Result match(final BallNumbers otherBalls) {
2929
return new Result(strike, ball);
3030
}
3131

32+
private boolean isSameBallNumber(BallNumber myBall, BallNumber otherBall) {
33+
return myBall.equals(otherBall);
34+
}
35+
3236
private boolean hasBallNumber(final BallNumber ballNumber) {
3337
return this.ballNumbers.contains(ballNumber);
3438
}

0 commit comments

Comments
 (0)