What do we mean by = new Comparator() in Java [duplicate]

This question already has an answer here:

I had a piece of code.

  compareScanMz = new Comparator<Triplet>() {
  @Override
  public int compare(Triplet o1, Triplet o2) {

    int scan1 = o1.scanListIndex;
    int scan2 = o2.scanListIndex;
    int scanCompare = Integer.compare(scan1, scan2);

    if (scanCompare != 0) {
      return scanCompare;
    } else {
      int mz1 = o1.mz;
      int mz2 = o2.mz;
      return Integer.compare(mz1, mz2);
    }
  }
};`

In the code I am able to figure out the other statements, but am unable to get the first one. i.e:

compareScanMz = new Comparator()

What does this statement mean?