The compare() method is a method of the RecordComparator interface. It is used to compare two values in a record store for sorting. The general syntax of this method is as follows:
Here, the rec1 parameter denotes the value of the first record to be compared.
The rec2 parameter denotes the value of the second record to be compared.
This comparison returns one of the following predefined integer values:
- EQUIVALENT
- PRECEDES
- FOLLOWS