Hi Matthias Thanks for the questions.
Regarding the return type: Iterable offers the option of being used in a foreach loop directly and it gives you access to the .iterator method, too. (ref: https://www.techiedelight.com/differences-between-iterator-and-iterable-in-java/ ) To return a List object would require an additional conversion and I don't see the immediate benefit. Regarding the ordering: outputRecordsByTopic gives back a Queue private final Map<String, Queue<ProducerRecord<byte[], byte[]>>> outputRecordsByTopic = new HashMap<>(); which has a LinkedList behind it outputRecordsByTopic.computeIfAbsent(record.topic(), k -> new LinkedList<>()).add(record); So the order is handled by the linked list and should not be modified by my changes, not even the .stream.map etc. (ref: https://stackoverflow.com/questions/30258566/java-stream-map-and-collect-order-of-resulting-container ) Then again, I am open to change it if people have some strong preference best regards Patrik On Thu, 11 Apr 2019 at 17:45, Matthias J. Sax <matth...@confluent.io> wrote: > Thanks for the KIP! > > Overall, this makes sense and can simplify testing. > > What I am wondering is, why you suggest to return an `Iterable`? Maybe > returning an `Iterator` would make more sense? Or a List? Note that the > order of emits matters, thus returning a generic `Collection` would not > seem to be appropriate. > > Can you elaborate on the advantages to use `Iterable` compared to the > other options? > > > > -Matthias > > On 4/11/19 2:09 AM, Patrik Kleindl wrote: > > Hi everyone, > > > > I would like to start the discussion on this small enhancement of > > the TopologyTestDriver. > > > > > https://cwiki.apache.org/confluence/display/KAFKA/KIP-451%3A+Make+TopologyTestDriver+output+iterable > > > > Pull request is available at https://github.com/apache/kafka/pull/6556 > > > > Any feedback is welcome > > > > best regards > > > > Patrik > > > >