java的集合框架

1.Collection 接口下的List和Set 

2.Map 接口下的hashMap 和TreeMap

  List 和Set的区别。List 允许重复的元素存在,Set不可以存在重复的元素。set中不允许存在重复的元素通过hashCode 和equals 方法来确定,只有当hashCode 相同的时候对equals进行比较。

  hashMap的元素是无序的,TreeMap里面的元素是有序的(自然顺序)。

对应要实现排序需要实现接口comparator 或者comparable。

 comparable接口实现方法

int compareTo(T o)

comparatoe需要接口实现方法
compare(T o1, T o2)
boolean equals(Object obj)
原文地址:https://www.cnblogs.com/sansyou/p/4133910.html