If every single implementation of List, Set, Queue, Iterator, etc. has to provide an implementation of the new lambda-capable methods (map, filter, et al) then it would be the most extreme violation of the DRY principle that the world has ever seen since CSS was invented.
Want to write a "throw-away" iterator...? You'd have to drop a tonne of extra code into the otherwise lightweight implementation, time and time again.
This is about pushing back against the extremes of boilerplate that modern Java seems to have evolved, just as much as it's about backwards compatibility. So no, it's not a "temporary fix"; it's a much needed, significant, and very welcome addition to the language for evermore.
On 21 August[masked]:57, Abraham Marín Pérez <[address removed]>
Replying to my own question about a scenario for defender methods, I read the example of backwards compatibility for interfaces. I see the usefulness of that, but I understand that in that scenario defender methods are meant to be sort of temporal (ie, eventually all clients will implement the new method and hence the default implementation would be removed). However, I'd like to know if there is any situation where a default implementation would be left permanently in the interface as a design decision.
Abraham Marín Pérez
Sent from my iPhone
On 21 Aug 2012, at 03:48, Abraham Marín Pérez<[address removed]> wrote:
Doesn't that defeat the very purpose of single class inheritance? It sounds like a hack to have multiple class inheritance: If I do interfaces where all methods are defender methods then I can mock multiple class inheritance.
I'm just trying to find a scenario where this could be useful.
Sent from my iPad
On 20 Aug 2012, at 19:58, Kevin Wright <[address removed]> wrote:
On 20 August[masked]:45, Abraham Marín Pérez <[address removed]>
This might be a silly question but... What's the difference between an interface with a default method and an abstract class with an implementation for that method?
Java has multiple interface inheritance, but single class inheritance. You could, potentially, inherit defender methods from multiple parents.
mail: [address removed]
gtalk / msn : [address removed]
vibe / skype: kev.lee.wright
"My point today is that, if we wish to count lines of code, we should not regard them as "lines produced" but as "lines spent": the current conventional wisdom is so foolish as to book that count on the wrong side of the ledger" ~ Dijkstra