The lambda expression is optional with first()
. first()
has a default
parameter that is a lambda expression that just returns true
. As a result:
first()
without a lambda expression returns the first item in the listfirst()
with a lambda expression returns the first item in the list for which the lambda expression evaluates totrue
You can learn more about this in:
Tags: