From 262d70272a2e542d645e9a01552e523c99e1aef8 Mon Sep 17 00:00:00 2001 From: Thomas Papendieck Date: Wed, 28 Nov 2018 17:51:58 +0100 Subject: [PATCH] production code refactored --- .../java/de/edu/hsfulda/ciip/tdd/BownlingCalculator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TDD-pure-function/src/main/java/de/edu/hsfulda/ciip/tdd/BownlingCalculator.java b/TDD-pure-function/src/main/java/de/edu/hsfulda/ciip/tdd/BownlingCalculator.java index 3166e56..8908da4 100644 --- a/TDD-pure-function/src/main/java/de/edu/hsfulda/ciip/tdd/BownlingCalculator.java +++ b/TDD-pure-function/src/main/java/de/edu/hsfulda/ciip/tdd/BownlingCalculator.java @@ -6,10 +6,10 @@ import java.util.regex.Pattern; public class BownlingCalculator { public int evaluate(String listOfThrows) { - Matcher matcher = Pattern.compile("\\d").matcher(listOfThrows); int sum =0; - while (matcher.find()) { - sum+=Integer.parseInt(matcher.group()); + Matcher singleDigit = Pattern.compile("\\d").matcher(listOfThrows); + while (singleDigit.find()) { + sum+=Integer.parseInt(singleDigit.group()); } return sum; }