On Tue, 05 Jun 2012 22:28:41 +0200, Cédric Beust ♔ <[email protected]>
wrote:
In an ideal world, the default case never crashes (empty collections) but
the language gives me a way to crash immediately if I receive
null/None/Nothing (without me having to explicitly test for it).
In my own stuff, I have finder methods that, when a result is expected,
throw a NotFoundException. It all depends on the case. OTOH there's a
point in returning an empty collection rather than null: that people, "in
doubt", would anyway write
List<> l = ...
if ((l != null) && !l.isEmpty())
which I hate. Being sure that l is not null, you can at least omit the (l
!= null).
--
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
[email protected]
http://tidalwave.it - http://fabriziogiudici.it
--
You received this message because you are subscribed to the Google Groups "Java
Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en.