I'm proposing the following single-method addition:
The initial implementation just cycles through 256 elements adding any that occur, and bailing when max occurs. It also checks for fractions, adding at least one if possible (it only checks certain tenths: i + ((i % 9) + 1) / 10.0). A smarter implementation could be done down the line.
if we removed the max parameter, and just hard-coded the max (at say 10), then we could compute the list statically for each distinct rulelist.
in C++, we'd deposit the results into an array, with the normal ICU idiom.
theoretically, one of the keywords could only apply above 256, or only be solitary under that.
Here is a test code run, with verbose on.
It's a bit inefficient to do this once per keyword, it's better to do it all in one go. In Java we could simply return a map, but in C there's no good API, unfortunately.
Since this proposes removing the 'max' parameter, though, we can simply cache the result internally and use it on subsequent calls. I'm going to default max to 3 since I see no good reason to provide more values.
Modified ICU4J version and submitted.
Opened a new bug for the ICU4C portion.
Milestone 4.7.1 deleted