Closed xulman closed 4 years ago
I cherry-picked the InputTriggerConfig.prettyPrintInputs commit to master.
I'm not comfortable with the TreeSet
keys.
Not so much because of performance impact, but because it is an implementation detail that is not obvious through the API.
If you call keys()
you get a Set<String>
and shouldn't make any assumptions. I would suggest that you either just wrap keys()
in a new TreeSet<>()
where you require it, or make another PR which adds a SortedSet<String> sortedKeys()
method.
Thank you considering the PR and accepting the pretty printing commit.
I understand you reasoning w.r.t. TreeSet
. Since the sortedKeys()
would be building the TreeSet
anyway (so we don't save anything performance-wise) and it is one-liner, I would leave it then on the client code to do whatever it wishes.. rather than creating/polluting API with getters in many flavors...
HI, here's a util-kind-of PR:
BehaviourMap
lists string keys sortedInputTriggerConfig
has a pretty printing static method (to obtain, e.g., "X or J" instead of "[X, J]" when printing the outcome ofgetInputs()
Example use case: