开发者学堂课程【大数据实时计算框架 Spark 快速入门:Spark textFile 和排序-4】学习笔记,与课程紧密联系,让用户快速学习知识。
课程地址:https://developer.aliyun.com/learning/course/100/detail/1697
Spark textFile 和排序-4
ScondSortKey 二次排序相关代码
1 package com. shsxt. study.core;
2
3import java. io.Serializable;
6
7public class SecondSortKey implements Serializable, Ordered{
8
9private static final long serialVersionUID =5431844887224611430L;
10
11private int first;
12private int second;
13@Override
15public String to String()
16return "SecondSortKey [first=" + first + ", second="+ second + "]";
17}
18
19@Override
20public int hashCode() (
21final int prime = 31;
22int result =1;
23result = prime * result + first;
24result =prime * result + second;
25return result;