- Type aliases
I really hate having to type code like
private Map<String, List<StringFormatter<DomainThing>>> map = new HashMap<String, List<StringFormatter<DomainThing>>>();It is so non-DRY that my fingers ache every time I see code like this.Here is an alternative:
private class DomainFormatterList : List<StringFormatter<DomainThing>>;Still some repetition, but a lot better already. Any ideas for improvement?
private Map<String, DomainFormatterList> map =
new HashMap<String, DomainFormatterList>();
- A non-static String.format method.
How often did I start with a literal String only to find out I had to move the cursor back to the left and put "String.format(" in front of it? It would have been easier if the format method were an instance method. Compare:String.format("Message for %d %s items", 5, "red");
"Message for %d %s items".format(5, "red");