Java - Objects isNull | Objects nonNull | When To Use | Example Java Program Code Demo InterviewDOT

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

Java - Objects isNull | Objects nonNull | When To Use | Example Java Program Code Demo InterviewDOT

Рекомендации по теме
Комментарии
Автор

Nice explanation bro#Instead of traditional if conditions java 8 brings in to good feature#

cloudtamil
Автор

Yes, from 0:25 on your explanation is exactly on point (I guess) as you elaborate on the API Note "This method exists to be used as a Predicate, filter(Objects::nonNull)". But from 0:20 to 0:25 you are a less on point (I would argue), as on line 16 you are using Objects.isNull() in a situation, that doesn't go with it's API Note "This method exists to be used as a Predicate, filter(Objects::isNull)". At line 16 there is "no win" out of this usage. It should (I would argue, YMMV) instead have been written the traditional way "if (numbers != null) {". Well, should or should not, of course it's up to you the programmer, do it as you like. But we may well take a short break and guess about why the API Note was written down explicitly (and not was left away, as could have been done, if "any" usage would have been intended).

volker-g
welcome to shbcf.ru