Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
romanNumeralsRefactored
import java.util.Map;
public class RomanNumerals {
private static final Map<Integer, String> ROMAN_NUMERALS = Map.of(
1, "I",
5, "V",
10, "X",
50, "L",
100, "C",
500, "D",
1000, "M"
);
public static String convert(int number) {
return ROMAN_NUMERALS.get(number);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment