mjsax commented on code in PR #14696:
URL: https://github.com/apache/kafka/pull/14696#discussion_r1396522548


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/assignment/Graph.java:
##########
@@ -103,8 +104,21 @@ public String toString() {
         }
     }
 
-    private final SortedMap<V, SortedMap<V, Edge>> adjList = new TreeMap<>();
-    private final SortedSet<V> nodes = new TreeSet<>();
+    private class KeyComparator implements Comparator<V> {
+
+        @Override
+        public int compare(final V o1, final V o2) {
+            if (o1 == null || o2 == null) {
+                return -1;

Review Comment:
   If one of both is `null`, why is `o1` considered smaller than `o2`? Would it 
not be better to define `null` as either smallest or largest globally? -- Also, 
should we return zero if both are `null`?



##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/assignment/Graph.java:
##########
@@ -117,6 +131,8 @@ private Graph(final boolean isResidualGraph) {
     }
 
     public void addEdge(final V u, final V v, final int capacity, final int 
cost, final int flow) {
+        Objects.requireNonNull(u);
+        Objects.requireNonNull(v);

Review Comment:
   Why do we need these checks?



-- 
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

Reply via email to