Commit 0813ae3b authored by Colin DAMON's avatar Colin DAMON
Browse files

Extract floor entry recuperation

parent 5cabb1e6
......@@ -10,7 +10,11 @@ public class Numerals {
private static final NavigableMap<Integer, String> CONVERSIONS = buildConversions();
public static String toRoman(int arabic) {
return Optional.ofNullable(CONVERSIONS.floorEntry(arabic)).map(romanRepresentation(arabic)).orElse("");
return highestKnownConversion(arabic).map(romanRepresentation(arabic)).orElse("");
}
private static Optional<Entry<Integer, String>> highestKnownConversion(int arabic) {
return Optional.ofNullable(CONVERSIONS.floorEntry(arabic));
}
private static Function<Entry<Integer, String>, String> romanRepresentation(int arabic) {
......
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