From: Gustavo Martin Morcuende Date: Sun, 27 Nov 2016 17:19:23 +0000 (+0100) Subject: Removing duplicated loop. X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=aa1dae4c40f28b7902158a57d420fb235e757454;p=JavaForFun Removing duplicated loop. Two loops were doing the same (appending letters) --- diff --git a/TDD/sandromancuso/romannumerals/src/main/java/org/craftedsw/romannumerals/RomanNumeralGenerator.java b/TDD/sandromancuso/romannumerals/src/main/java/org/craftedsw/romannumerals/RomanNumeralGenerator.java index e24a8da..4f7f40d 100644 --- a/TDD/sandromancuso/romannumerals/src/main/java/org/craftedsw/romannumerals/RomanNumeralGenerator.java +++ b/TDD/sandromancuso/romannumerals/src/main/java/org/craftedsw/romannumerals/RomanNumeralGenerator.java @@ -10,16 +10,14 @@ public class RomanNumeralGenerator { decimal -= romanToDecimal.decimal; } } - for (int i = 0; i < decimal; i++) { - roman += "I"; - } return roman; } enum RomanToDecimal { TEN("X", 10), - FIVE("V", 5); + FIVE("V", 5), + ONE("I", 1); private final String roman; private final int decimal;