jdbm.helper

## Class ObjectBAComparator

- java.lang.Object
- - jdbm.helper.ObjectBAComparator

All Implemented Interfaces:
  Serializable, Comparator

    public final class ObjectBAComparator
    extends Object
    implements Comparator, Serializable

Comparator for objects which have been serialized into byte arrays. In effect, it wraps another Comparator which compares object and provides transparent deserialization from byte array to object.

Author:
  Alex Boisvert
See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`ObjectBAComparator(Comparator comparator)` Construct an ObjectByteArrayComparator which wraps an Object Comparator.

### Method Summary

Methods
`int` `compare(Object obj1, Object obj2)` Compare two objects.
`static int` `compareByteArray(byte[] thisKey, byte[] otherKey)` Compare two byte arrays.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.util.Comparator

`equals`

### Constructor Detail

#### ObjectBAComparator

    public ObjectBAComparator(Comparator comparator)

Construct an ObjectByteArrayComparator which wraps an Object Comparator.

Parameters:
  `comparator` - Object comparator.

### Method Detail

#### compare

    public int compare(Object obj1,
              Object obj2)

Compare two objects.

Specified by:
  `compare` in interface `Comparator`
Parameters:
  `obj1` - First object
  `obj2` - Second object
Returns:
  1 if obj1 > obj2, 0 if obj1 == obj2, -1 if obj1 < obj2

#### compareByteArray

    public static int compareByteArray(byte[] thisKey,
                       byte[] otherKey)

Compare two byte arrays.