32

Java中的Comparable接口和Comparator接口-java架构师1的博客

 5 years ago
source link: http://blog.51cto.com/13981400/2325028
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
介绍Comparable<T>接口和Comparator<T>接口都是JDK中提供的和比较相关的接口。使用它们可以对对象进行比较大小,排序等操作。这算是之后排序的先导知识吧。Comparable,字面意思是“可以比较的”,所以实现它的类的多个实例应该可以相互比较“大小”或者“高低”等等。Comparator,字面意思是“比较仪,比较器”,它应该是专门用来比较用的“工具”。C

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK