File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
number-baseball/src/main/java/io/github/gunkim/baseball/domain Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments