I recently needed a way to use a Predicate to select things from a list, but I also wanted to know which ones failed the predicate test.
I wanted the following, but with one iteration instead of two:
This is what I came up with based on the CollectionUtils.select(...) method:
This will of course throw a NullPointerException if either output collection is null. This seems appropriate since we need to return two outputs anyway.
Not sure if bisect is the best name, but this method will split the original into two pieces. https://www.google.com/#q=define+bisect