Defaults

Learn about interface default methods.

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.

Get hands-on with 1400+ tech skills courses.