Oh, my head hurts! ;-) There are already three setBody methods.
I agree, a boolean like this can be confusing. A setBodyRestartable(Itr), and setBodyNonRestarable(Itr) may be a possible solution here. But ( what I think you are suggesting too ), Iterable implementations should do the right thing, they should always be "restartable".
Maybe/Simply remove the restartable boolean param and put a note in the spec that Iterable implementations that for whatever reason cannot be restarted should perform some kind of caching. So we only support "honest" Iterables.
Unless I'm missing some valid use-case that demands this non-restartable API.
-Chris. On 08/08/12 20:09, Ian Robertston wrote:
Instead of HttpRequest having void setBody(Iterable<ByteBuffer> buffers, boolean isRestartable) what about having two methods: void setBody(Iterable<ByteBuffer> buffers) // presumed restartable void setBody(Iterator<ByteBuffer> buffers) // clearly not restartable Not only does this avoid a potentially confusing boolean parameter, but it also avoids forcing people to create "dishonest" Iterables, where they know the iterator() method cannot be called more than once. - Ian