Objects.nonNull()

Ulf Zibis Ulf.Zibis at gmx.de
Thu Jan 13 23:57:02 UTC 2011


Am 13.01.2011 23:38, schrieb Brian Goetz:
>
> People use these to simplify cases like
>
>   if (foo != null)
>     for (Foo f : foo) { ... }
>
> to
>
>   for (Foo f : nonNull(foo)) { ... }

To be honest, I don't understand the real value of nonNull().
If the argument is null, NPE would be thrown anyway.
Do I miss something?

-Ulf




More information about the core-libs-dev mailing list