June 2002
Intermediate to advanced
504 pages
10h 10m
English
So far, you've accessed records by their primary index only. But what if you want to sort the journeys in the previous example's travel list by the length of the trip or the date, without requiring that they all be entered in the correct order? For this purpose, RMS provides record enumerations.
Record enumerations let you visit all the records in a record store in a custom order. The first step is to define the custom order. You do so by implementing the compare() method of the RecordComparator interface, which defines an order for the records. The compare() method takes two byte arrays as parameters. It returns one of the constants EQUIVALENT, FOLLOWS, or PRECEDES, depending on the relative ...
Read now
Unlock full access