I have strings of digits ('numbers') that correspond to strings, not all matches are unique, but the numbers are. Nothing changes, it's all constant. Something like this:
10023 - "Hugo" - "Boss"
023 - "Big" - "Boss"
1230 - "Hugo" - "A or B"
// ...and about twenty more like that
what i want, is to be able to receive a string of digits, and then get the two strings for that.
The enum way isn't neat, because i cannot call the enum a number (needs a leading non-digit), otherwise i could go with the whole song-and-dance of defining an enum and then getting the values by looking for the right one with Enum.valueOf(), and the method way is not neat because it is ugly and unreadable during definition.
public class detailsForNumber {
public String first;
public String second;
public detailsForNumber(String number) {
if (number == "10023") {
first = "Hugo";
second = "Boss";
} else if (number == "023")
//.....and so on
//Then i could later and somewhere else go:
Somewhere.detailsForNumber dFN = Somewhere.detailsForNumber("023");
System.out.println(dFN.first); // Prints 'Big'
is there a readable way to define this relationship somewhere and then a reasonable way to get the strings out of there?
Ideally it would be a non-headache to later add a third string, or have a non-digit character in the 'number', but there will be no changes at runtime.