Closed GoogleCodeExporter closed 9 years ago
Most of the Supplier methods (memoization and constant suppliers) could be
trouble for stateful objects like Iterators. Synchronization should be safe,
though I'm unsure when it would be sufficient to synchronize Iterator creation
but not the next/hasNext calls themselves. Can you go into more detail about
this or about any other Supplier methods that you'd use with Iterator?
Original comment by cpov...@google.com
on 20 Aug 2013 at 6:22
This reminds me of
https://code.google.com/p/guava-libraries/wiki/IdeaGraveyard#A_method_to_view_an
_iterator_as_an_iterable
Original comment by kak@google.com
on 20 Aug 2013 at 6:25
I don't have the original code in front of me and it looks like Iterables now
has far more methods than I last looked.
That being said I think the reason Supplier<Iterator<>> was used is ironically
because of the Supplier interface not making any assumptions where as the
Iterable interface it is assumed that a collection is generally backing it. An
InputSupplier is probably a better fit (even though an IOException is not
thrown).
Original comment by adam.g...@snaphop.com
on 20 Aug 2013 at 6:48
I see. If it's something lightweight, I wouldn't let the lack of an underlying
collection keep you from using Iterable. If it's heavier, then you may be
interested in issue 973, which proposes a heavyweight, Iterator-like class
(possibly with its own Iterable/Supplier-like interface). We don't expect to
get to it anytime soon, though.
Original comment by cpov...@google.com
on 20 Aug 2013 at 6:56
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<issue id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:12
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:08
Original issue reported on code.google.com by
adam.g...@snaphop.com
on 20 Aug 2013 at 6:16