Removing duplicated loop.
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 27 Nov 2016 17:19:23 +0000 (18:19 +0100)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 27 Nov 2016 17:19:23 +0000 (18:19 +0100)
Two loops were doing the same (appending letters)

TDD/sandromancuso/romannumerals/src/main/java/org/craftedsw/romannumerals/RomanNumeralGenerator.java

index e24a8da..4f7f40d 100644 (file)
@@ -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;