Re:Java 7 is now available
by spullara on Thursday July 28, 2011 @02:39PM
(#2818280)
One other great feature in JDK8 will be defender methods which will allow interfaces to carry default behavior for methods. This will be the mechanism for adding default behavior in the collection libraries without breaking classes that extend them. It will also have a lot of great use cases in new library development.
[ Parent
| on HN ]
I wasn't even aware of that proposal, just found these examples[1] and love the idea.
Sort of in the same vein as static imports (as far as usability) but has a really nice added side effect of exporting a default impl from an interface that can be overridden.
Thanks!
[1] http://www.baptiste-wicht.com/2010/05/java-7-add-public-defe...