# Class SAMHeaderRecordComparator<T extends AbstractSAMHeaderRecord>

java.lang.Object
htsjdk.samtools.SAMHeaderRecordComparator<T>

All Implemented Interfaces:
  `Serializable, Comparator<T>`

public class SAMHeaderRecordComparator<T extends AbstractSAMHeaderRecord> extends Object implements Comparator<T>, Serializable
Provides ordering based on SAM header records' attribute values. Provide the list of attributes to use in the comparison to the constructor. Null attribute values (i.e., those attributes not present in the record) sort behind those that have values.

See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`SAMHeaderRecordComparator(String... attributes)`

## Method Summary

Modifier and Type
Method
Description
`int`
`compare(T left, T right)`

### Methods inherited from class Object

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

### Methods inherited from interface Comparator

`equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

## Constructor Details

### SAMHeaderRecordComparator

public SAMHeaderRecordComparator(String... attributes)

## Method Details

### compare

public int compare(T left, T right)

Specified by:
  `compare` in interface `Comparator<T extends AbstractSAMHeaderRecord>`