IT. Expert System.

Android Reference

CursorJoiner


android.database

Class CursorJoiner

  • All Implemented Interfaces:
    Iterable<CursorJoiner.Result>, Iterator<CursorJoiner.Result>


    public final class CursorJoiner
    extends Object
    implements Iterator<CursorJoiner.Result>, Iterable<CursorJoiner.Result>
    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;
         }
     }
     
    • Constructor Detail

      • CursorJoiner

        public CursorJoiner(Cursor cursorLeft,
                    String[] columnNamesLeft,
                    Cursor cursorRight,
                    String[] columnNamesRight)
        Initializes the CursorJoiner and resets the cursors to the first row. The left and right column name arrays must have the same number of columns.
        Parameters:
        cursorLeft - The left cursor to compare
        columnNamesLeft - The column names to compare from the left cursor
        cursorRight - The right cursor to compare
        columnNamesRight - The column names to compare from the right cursor
    • Method Detail

      • next

        public CursorJoiner.Result next()
        Returns the comparison result of the next row from each cursor. If one cursor has no more rows but the other does then subsequent calls to this will indicate that the remaining rows are unique.

        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.

        Specified by:
        next in interface Iterator<CursorJoiner.Result>
        Returns:
        LEFT, if the row pointed to by the left cursor is unique, RIGHT if the row pointed to by the right cursor is unique, BOTH if the rows in both cursors are the same.
        See Also:
        Iterator.hasNext()
      • remove

        public void remove()
        Description copied from interface: Iterator
        Removes the last object returned by next from the collection. This method can only be called once between each call to next.
        Specified by:
        remove in interface Iterator<CursorJoiner.Result>


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 386 / . Delta: 0.02359 с