Closed GoogleCodeExporter closed 9 years ago
We have a strong philosophical difference. We have opposed these kinds of
null-tolerant APIs for years. To our minds, 'null' is not an empty Iterable;
it's
'null', and no one should ever be passing it around as if it were an empty
Iterable.
You should work to banish null from your codebase, or get used to the constant
checking, or continue using libraries like the Apache one.
As a side point, no one should ever use "Iterables.size() == 0" in place of
Iterables.isEmpty()!
Original comment by kevin...@gmail.com
on 27 Oct 2009 at 1:54
I would have to concur with Kevin. Additionally, GCL is not going to be close a
1-1 replacement for commons-
collections. If you merely replace all apache calls with GCL calls with similar
functions, your code will almost
certainly break.
Besides the one philosophical difference that Kevin mentions, there are others.
Another is that most every thing
commons-collections returns is a new detached collection, while most everything
GCL returns is lazy if possible.
There's a big difference, and this happens to be my personal biggest pet peeve
with the apache project.
Original comment by ray.a.co...@gmail.com
on 28 Oct 2009 at 10:03
Kevin, if you're not handling null inputs, then what benefit does isEmpty()
provide?
In other words, why should I call Iterables.isEmpty(iterator) instead of
iter.iterator.hasNext(), if not for an easy way to avoid null checks?
Original comment by mark.jef...@gmail.com
on 29 Aug 2012 at 12:42
Original issue reported on code.google.com by
emil.van...@logica.com
on 27 Oct 2009 at 10:17