extension methods

Java's missing feature: extension methods

What is an extension method? An extension method is the ability to “add” a method directly to an existing type without creating a new derived type, recompiling, or otherwise modifying the existing type. When calling an extension method, there is no significant difference compared to calling the actual method defined in the type. Why you need extension methods Consider a function that, after fetching a string containing multiple item IDs from Redis (each item ID is separated by an English comma), first de-duplicates the item IDs (and is able to maintain the order of the elements), and then finally concatenates the individual item IDs using English commas.