Skip to content
Snippets Groups Projects
Commit 0813ae3b authored by Colin DAMON's avatar Colin DAMON
Browse files

Extract floor entry recuperation

parent 5cabb1e6
No related branches found
No related tags found
1 merge request!37Resolve "TCR Roman Numerals"
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment