Commit 4fb60df6 authored by Colin DAMON's avatar Colin DAMON
Browse files

Rename method

parent 0813ae3b
...@@ -10,14 +10,14 @@ public class Numerals { ...@@ -10,14 +10,14 @@ public class Numerals {
private static final NavigableMap<Integer, String> CONVERSIONS = buildConversions(); private static final NavigableMap<Integer, String> CONVERSIONS = buildConversions();
public static String toRoman(int arabic) { public static String toRoman(int arabic) {
return highestKnownConversion(arabic).map(romanRepresentation(arabic)).orElse(""); return highestKnownConversion(arabic).map(toRomanRepresentation(arabic)).orElse("");
} }
private static Optional<Entry<Integer, String>> highestKnownConversion(int arabic) { private static Optional<Entry<Integer, String>> highestKnownConversion(int arabic) {
return Optional.ofNullable(CONVERSIONS.floorEntry(arabic)); return Optional.ofNullable(CONVERSIONS.floorEntry(arabic));
} }
private static Function<Entry<Integer, String>, String> romanRepresentation(int arabic) { private static Function<Entry<Integer, String>, String> toRomanRepresentation(int arabic) {
return conversion -> conversion.getValue() + toRoman(arabic - conversion.getKey()); return conversion -> conversion.getValue() + toRoman(arabic - conversion.getKey());
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment