J2ME: RecordEnumeration Ordering?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gilgantic

    J2ME: RecordEnumeration Ordering?

    How do you reverse the order in an J2ME RecordEnumerati on? I get a
    result of 3, 2, 1 instead of 1, 2, 3 for the code below.

    RecordEnumerati on enum = recordStore.enu merateRecords(n ull, null,
    false); while( enum.hasNextEle ment() )
    {
    byte[] data = enum.nextRecord ();
    String recordStr = readRecord( data );
    System.out.prin tln(recordStr);
    }

    What's the deal here?
  • Anton Spaans

    #2
    Re: RecordEnumerati on Ordering?


    "gilgantic" <gilgantic@yaho o.com> wrote in message
    news:d6052717.0 403232215.5941c bc6@posting.goo gle.com...[color=blue]
    > How do you reverse the order in an J2ME RecordEnumerati on? I get a
    > result of 3, 2, 1 instead of 1, 2, 3 for the code below.
    >
    > RecordEnumerati on enum = recordStore.enu merateRecords(n ull, null,
    > false); while( enum.hasNextEle ment() )
    > {
    > byte[] data = enum.nextRecord ();
    > String recordStr = readRecord( data );
    > System.out.prin tln(recordStr);
    > }
    >
    > What's the deal here?[/color]

    The order in which the records are returned is never guaranteed (better:
    they are not ordered).
    If you want to order the record-enumeration, use the
    javax.microedit ion.rms.RecordC omparator interface.

    -- Anton.


    Comment

    Working...