jeudi 27 avril 2017

Java default interface methods concrete use cases

Java 9 is near to come and more features will be added to Java interfaces, like private methods. default methods in interfaces were added in Java 8, essentially to support the use of lambdas inside collections without breaking retro-compatibility with previous versions of the language.

In Scala, methods inside traits are quite useful. However, Scala has a different approach treating traits than Java with default methods. Think to multiple inheritance resolution or the use of traits as mixins.

Apart the above use, which are the real scenarios in which using a default methods is worth? During this years is it arisen some pattern that uses them? Which problems can I solve using this kind of methods?

Aucun commentaire:

Enregistrer un commentaire