With an enum like this one where each key has several values
ABBR1("long text 1", "another description 1", "yet another one 1"),
ABBR2("long text 2", "another description 2", "yet another one 2"),
//and so on...
how can I reverse lookup an abbreviation (constant) by calling a method like getAbbreviation(descriptionText)
?
I'm basically looking for an implementation as described here, I think, but with the difference that each ENUM key (constant) has several values coming with it, and I want it to work with getAbbreviation("long text 1")
as well as with getAbbreviation("yet another one 2")
...
Is there an easy way to loop over each ENUM's (i.e. ABBRn
's) value fields, to populate a giant map, or is there maybe even a better solution?