'Combine two cursors (merge?), by keeping all distinct IDs from both cursors

Say I have two cursors(called A and B). A and B has some columns identical, but the only true relation between the two is a single column, call it specialID. Cursor A is filled via a ContentProvider, whereas B contains all distinct IDs from a database of mine.

Is it possible to somehow merge the two cursor in a way that, Example A:

if A contains specialID 1,2,3,4,5 and B contains specialID 3,5,6,8 the result would be: 1,2,3,4,5,6,8 (keep all uniqe specialIDs from both cursors that is)

Example B:

if A contains no rows and B contains specialID 4,5,6 the result would be: 4,5,6



Solution 1:[1]

I don't know if you specifically want a Cursor implementation that merges two Cursors in the way that you ask, there is a class called CursorJoiner though which does exactly what you want, but it's not a Cursor implementation.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 soren.qvist