public static void main(String[] args){
SparkConf conf = new SparkConf().setAppName("org.sparkexample.sampleCode").setMaster("local");
JavaSparkContext sc = new JavaSparkContext(conf);
JavaRDD lines = sc.textFile("C:\\User\\Ritu\\sampledata");
JavaPairRDD lineLengths = lines.map(s -> s.split(";",-1)).filter(s->!s[0].equals("1")).mapToPair(s->new Tuple2(s[0],s[0]+";"+s[1]+";"+s[2]));
JavaPairRDD counts = lineLengths.reduceByKey((a,b)->a+b);
Sytem.out.println(counts.collect());
Input
1;you man; 23
112;me man;23
112;me man;27
112;me man;29
12;suman;23
a) []
b) [(112,112;you man;23112;you man;27112;you man;29)]
c) Run time error - A
d) [(112,112;you man;23112;you man;27112;you man;29),(12,12;suman;23)]