I have a large data set of objects, made up of 2 large-ish subsets.
- Set 1 has about 10,000 objects in it.
- Set 2 has about 70,000 objects in it.
- The object sets have many-to-many relationships between them.
- There are also "favorites" subsets for both sets.
Before I display set 1 or set 2, I will have a subset from the other set to drive my query/fetch.
Let's say:
- I have selected 10 objects from set 1.
- I would like to display set 2.
I'd like set 2 to be grouped into 3 sections:
- Section 1 would be objects in set 2 that have relationships with the 10 selected objects from set 1.
- Section 2 would be objects in the "favorites" subset that are NOT in #1.
- Section 3 would be the rest.
So, conceptually, I have the following steps (again, given 10 selected objects from set 1 and a "favorites" subset from set 2):
- Figure out which objects in set 2 correspond to the selected objects from set 1.
- Set #1 aside and remove them from the overall set (but only for this display).
- Figure out which objects are left in set 2 that are also in the "favorites" subset.
- Set #2 aside and remove them from the overall set (again, only for this display).
- Figure out which objects are left.
At the end of this, I'd like to display the 3 sections in a UITableView
.
I saw this question, but I wasn't sure whether the supplied answers were:
- Still valid (it's been almost 7 years since the question was asked)
- Valid for my use case. (Would the calculated method return a section number? If so, would I have to pass in both subsets on which I am doing my filtering? How is that going to perform with such large data sets?)