AllLab_Skeleton.Lab2.Lab2GroupComparator.java Source code

Java tutorial

Introduction

Here is the source code for AllLab_Skeleton.Lab2.Lab2GroupComparator.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package AllLab_Skeleton.Lab2;

import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

/**
 *
 * @author pooja
 */
public class Lab2GroupComparator extends WritableComparator {

    protected Lab2GroupComparator() {
        super(CompositeKeyWritable.class, true);
    }

    @Override
    public int compare(WritableComparable w1, WritableComparable w2) {
        CompositeKeyWritable cw1 = (CompositeKeyWritable) w1;
        CompositeKeyWritable cw2 = (CompositeKeyWritable) w2;

        return (cw1.getDeptNo().compareTo(cw2.getDeptNo()));
    }
}