Public class MaxTemperature {
// Mapper Class
Public static class TempMapper extends Mapper<Object, Text, Text, IntWritable> {
Private Text year = new Text();
Private IntWritable temperature = new IntWritable();
Public void map(Object key, Text value, Context context)
Throws IOException, InterruptedException {
String[] parts = [Link]().split(\\s+);
If ([Link] == 2) {
[Link](parts[0]);
[Link]([Link](parts[1]));
[Link](year, temperature); }} }
// Reducer Class
Public static class TempReducer extends Reducer<Text, IntWritable, Text, IntWritable> {
Public void reduce(Text key, Iterable<IntWritable> values, Context context)
Throws IOException, InterruptedException {
Int maxTemp = Integer.MIN_VALUE;
For (IntWritable temp : values) {
maxTemp = [Link](maxTemp, [Link]()); }
[Link](key, new IntWritable(maxTemp)); } }
// Driver Code
Public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
Job job = [Link](conf, “Max Temperature per Year”);
[Link]([Link]);
[Link]([Link]);
[Link]([Link]);
[Link]([Link]);
[Link]([Link]);
[Link](job, new Path(args[0]));
[Link](job, new Path(args[1]));
[Link]([Link](true) ? 0 : 1); }}