|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.database.CursorJoiner
public final class CursorJoiner
Does a join on two cursors using the specified columns. The cursors must already be sorted on each of the specified columns in ascending order. This joiner only supports the case where the tuple of key column values is unique.
Typical usage:
CursorJoiner joiner = new CursorJoiner(cursorA, keyColumnsofA, cursorB, keyColumnsofB);
for (CursorJointer.Result joinerResult : joiner) {
switch (joinerResult) {
case LEFT:
// handle case where a row in cursorA is unique
break;
case RIGHT:
// handle case where a row in cursorB is unique
break;
case BOTH:
// handle case where a row with the same key is in both cursors
break;
}
}
| Nested Class Summary | |
|---|---|
static class |
CursorJoiner.Result
The result of a call to next(). |
| Constructor Summary | |
|---|---|
CursorJoiner(Cursor cursorLeft,
String[] columnNamesLeft,
Cursor cursorRight,
String[] columnNamesRight)
Initializes the CursorJoiner and resets the cursors to the first row. |
|
| Method Summary | |
|---|---|
boolean |
hasNext()
Returns whether or not there are more rows to compare using next(). |
Iterator<CursorJoiner.Result> |
iterator()
Returns an Iterator for the elements in this object. |
CursorJoiner.Result |
next()
Returns the comparison result of the next row from each cursor. |
void |
remove()
Removes the last object returned by next from the
collection. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CursorJoiner(Cursor cursorLeft,
String[] columnNamesLeft,
Cursor cursorRight,
String[] columnNamesRight)
cursorLeft - The left cursor to comparecolumnNamesLeft - The column names to compare from the left cursorcursorRight - The right cursor to comparecolumnNamesRight - The column names to compare from the right cursor| Method Detail |
|---|
public Iterator<CursorJoiner.Result> iterator()
IterableReturns an Iterator for the elements in this object.
iterator in interface Iterable<CursorJoiner.Result>Iterator instance.public boolean hasNext()
hasNext in interface Iterator<CursorJoiner.Result>Iterator.next()public CursorJoiner.Result next()
The caller must check that hasNext() returns true before calling this.
Once next() has been called the cursors specified in the result of the call to next() are guaranteed to point to the row that was indicated. Reading values from the cursor that was not indicated in the call to next() will result in undefined behavior.
next in interface Iterator<CursorJoiner.Result>Iterator.hasNext()public void remove()
Iteratornext from the
collection.
remove in interface Iterator<CursorJoiner.Result>
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||