2017-11-7课堂作业

来源:互联网 发布:时间闹钟提醒软件 编辑:程序博客网 时间:2024/06/06 00:53

List:void add
boolean addAll
Object get
int indexOf
int lastIndexOf
Object remove
Object set
List subList

Map:

Hashtable:是一个古老的 Map 实现类,不建议使用。
是一个线程安全的 Map 实现,但 HashMap 是线程不安全的。
不允许使用 null 作为 key 和 value,而 HashMap 可以。

LinkedHashMap:是 HashMap 的子类。
可以维护 Map 的迭代顺序:迭代顺序与 Key-Value 对的插入顺序一致。
TreeMap:存储 Key-Value 对时,需要根据 Key 对 key-value 对进行排序。
可以保证所有的 Key-Value 对处于有序状态。

Collections :

reverse(List):反转 List 中元素的顺序。
shuffle(List):对 List 集合元素进行随机排序。
sort(List):根据元素的自然顺序对指定 List 集合元素按升序排序。
sort(List,Comparator):根据指定的 Comparator 产生的顺序对 List 集合元素进行排序。
swap(List,int,int):将指定 list 集合中的 i 处元素和 j 处元素进行交换。

原创粉丝点击