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 trait
s are quite useful. However, Scala has a different approach treating trait
s than Java with default
methods. Think to multiple inheritance resolution or the use of trait
s 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