Working with polymorphism collections, list, arraylists etc.
I have a sorted collection that I would like to split based on one of the objects properties. All records > 0 to one; all less than to another. I'm trying to think of the best way to implement this. I'm thinking Comparable/Comparator sorting and then iterating through the collection until I hit 0 and splitting there but it also occurs to me that theres gotta be an easier way.
If you are using an array already, you could do a sort and get the index in the middle for splitting as well. The algorithm has bigger Big O and a bit more complex but requires less space use in the process.