dcapwell commented on code in PR #46:
URL: https://github.com/apache/cassandra-accord/pull/46#discussion_r1202791441


##########
accord-core/src/main/java/accord/primitives/Ranges.java:
##########
@@ -227,4 +230,27 @@ else if (count == result.length)
         return construct(cachedRanges.completeAndDiscard(result, count));
     }
 
+    public Partition partition(Predicate<Range> test)
+    {
+        List<Range> left = new ArrayList<>();
+        List<Range> right = new ArrayList<>();
+        for (Range range : this)
+            (test.test(range) ? left : right).add(range);

Review Comment:
   was trying to find other APIs to see if there are better names... and best I 
see in JDK is
   
   ```
   Map<Boolean, List<Integer>> groups = 
intList.stream().collect(Collectors.partitioningBy(s -> s > 6));
   ```
   
   So rather than an object with true/false, this returns a `Map<Boolean, T>`
   
   I don't mind mimicking this API if you think its best



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to