import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;

import java.io.IOException;
import java.util.StringTokenizer;

// >>> Don't Change
public class OrphanPages extends Configured implements Tool {

    public static void main(String[] args) throws Exception {
        int res = ToolRunner.run(new Configuration(), new OrphanPages(), args);
        System.exit(res);
    }
// <<< Don't Change

    @Override
    public int run(String[] args) throws Exception {
        //TODO
    }

    public static class LinkCountMap extends Mapper<Object, Text, IntWritable, IntWritable> {
        @Override
        public void map(Object key, Text value, Context context) throws IOException, InterruptedException {
            //TODO
        }
    }

    public static class OrphanPageReduce extends Reducer<IntWritable, IntWritable, IntWritable, NullWritable> {
        @Override
        public void reduce(IntWritable key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException {
            //TODO
        }
    }
}
@@ -626,16 +626,73 @@
 nizer;%0A%0A
+%0A// my code ???%0Aimport org.apache.hadoop.fs.FileSystem;%0A%0A
 // %3E%3E%3E D
@@ -1032,268 +1032,1533 @@
 n %7B%0A
-        //TODO%0A    %7D%0A%0A    public static class LinkCountMap extends Mapper%3CObject, Text, IntWritable, IntWritable%3E %7B%0A        @Override%0A        public void map(Object key, Text value, Context context) throws IOException, InterruptedException %7B%0A            //TODO
+%09// my code%0A        Configuration conf = this.getConf();%0A        FileSystem fs = FileSystem.get(conf);%0A        Path tmpPath = new Path(%22/mp2/tmp%22);%0A        fs.delete(tmpPath, true);%0A%0A        Job jobA = Job.getInstance(conf, %22Orphan Page%22);%0A        jobA.setOutputKeyClass(IntWritable.class);%0A        jobA.setOutputValueClass(NullWritable.class);%0A%0A%09jobA.setMapOutputKeyClass(IntWritable.class);%0A        jobA.setMapOutputValueClass(IntWritable.class);%0A%0A        jobA.setMapperClass(LinkCountMap.class);%0A        jobA.setReducerClass(OrphanPageReduce.class);%0A%0A        FileInputFormat.setInputPaths(jobA, new Path(args%5B0%5D));%0A%09FileOutputFormat.setOutputPath(jobA, new Path(args%5B1%5D));%0A%0A        jobA.setJarByClass(OrphanPages.class);%0A        return jobA.waitForCompletion(true) ? 0 : 1;%0A    %7D%0A%0A    public static class LinkCountMap extends Mapper%3CObject, Text, IntWritable, IntWritable%3E %7B%0A        @Override%0A        public void map(Object key, Text value, Context context) throws IOException, InterruptedException %7B%0A%09%09// my code%0A                String curLine = value.toString();%0A%09%09String%5B%5D parts = curLine.split(%22:%22);%0A                context.write(new IntWritable(Integer.parseInt(parts%5B0%5D)), new IntWritable(0));%0A%09%09StringTokenizer tokenizer = new StringTokenizer(parts%5B1%5D);%0A%0A                while(tokenizer.hasMoreTokens()) %7B%0A                        String nextToken = tokenizer.nextToken();%0A                        context.write(new IntWritable(Integer.parseInt(nextToken.trim().toLowerCase())), new IntWritable(1));%0A                %7D
 %0A   
@@ -2839,26 +2839,158 @@
 n %7B%0A
-            //TODO
+%09%09// my code%0A%09%09int sum = 0;%0A%09%09for(IntWritable val : values) %7B%0A%09%09%09sum += val.get();%0A%09%09%7D%0A%09%09if(sum == 0) %7B%0A%09%09%09context.write(key, NullWritable.get());%0A%09%09%7D
 %0A   
@@ -3003,8 +3003,9 @@
 %0A    %7D%0A%7D
+%0A

Modify OrphanPages.java to find orphan pages in Wikipedia