Defaults
Explore how Java 8 introduces default methods in interfaces to support backward compatibility and add new behaviors without breaking existing code. Understand the use of static methods in interfaces and how to resolve conflicts when multiple interfaces define the same default method.
We'll cover the following...
We'll cover the following...
Default methods
To add the stream method (or any others) to the core Collections API, Java needs another new feature, Default methods (also known as Defender Methods or Virtual Extension methods). For example, they could add new methods to the List interface without breaking all the existing implementations, known as backward compatibility.
Default methods can be added ...