17.8 Java 8 Stream Api Features part 7 foreach method in Iterable Interface

preview_player
Показать описание


Follow on Facebook:

Subscribe to our other channel:
Telusko Hindi :
Рекомендации по теме
Комментарии
Автор

Hi Navin, this concept was introduced in java 1.8, but you can modify interfaces created before java 1.8 as well, so long you use default keyword to declare new methods in the old interfaces, this is an extensive feature that enable us to modify the older interfaces without creating error in the already published interfaces, so it's not peculiar to interfaces implemented from java 1.8 and above.

Take a closer look at the Iterable interface on which the forEach method was declared, you will see that it's actually from java 1.5, while the foreach method, implemented in it, was at the development of java 1.8.

So In a not shell, i think you can make changes to any interface going forward, including older interfaces, and the List interface is not an exception to that rule, because if you closely observe the List interface it self, you will see that it has been available since java 1.2, but the sort method declared in it was implemented in java 1.8, but with a default keyword.

Welldone and best regards, keep doing the good work.

fabianmadueke
Автор

it just boils my blood for the extremely poor sound quality

saumyasundaram
Автор

how do you magically switch to the source codes of the functions implemented there!

hemantranjan
welcome to shbcf.ru