gharris1727 commented on code in PR #16486: URL: https://github.com/apache/kafka/pull/16486#discussion_r1669039009
########## connect/runtime/src/main/java/org/apache/kafka/connect/runtime/distributed/IncrementalCooperativeAssignor.java: ########## @@ -793,6 +796,43 @@ protected void assignConnectors(List<WorkerLoad> workerAssignment, Collection<St } } + static class BalancedIterator<E> implements Iterator<E> { + + private final Map<String, Iterator<E>> grouped; + private final List<String> keys; + + private int k; + + public BalancedIterator(Collection<E> collection, Function<E, String> allocationGrouper) { + this.k = 0; + this.grouped = collection.stream().collect(Collectors.groupingBy( + allocationGrouper, + Collectors.collectingAndThen( + Collectors.toList(), + List::iterator + ) + )); + this.keys = new ArrayList<>(grouped.keySet()); Review Comment: Bump on this, as I think it's still an issue. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org