This is another example, but I wrote this line of code:
@Override public Map<Action, Promise<Boolean>> actOnResults() throws Exception { return Collections.singletonMap(Action.UPDATE_DATABASE, saver.save(results)); }
pay attention to @Override . An interface, more generally, can display maps of many things; this particular instance always returns a card containing one thing. Also note that the key to the card is Enum. Thus, cards should never be large, they simply should contain the results of the actions indicated. In my real example, there are up to 5 actions, and this instance uses only one of them.
To be complete, EnumSet or EnumMap often suitable in these cases, but they are still annoyingly EnumMap compared to the code above.
djechlin Aug 14 '14 at 6:59 a.m. 2014-08-14 18:59
source share