https://kotlinlang.org logo
t

Trevor

11/14/2017, 7:58 PM
Right, logins will never be null, it's just an empty list. However throwing a
NoSuchElementException
is nice cause we know this is exceptional behaviour, but that happens when this code is already in front of the user. Why wouldn't first() be nullable and force us to handle the case of an empty list at compile time before it reaches the user?