Collection接口:
Set接口:(无序,内容不可以重复)
HashSet:
方法:retainAll()
addAll()
//TreeSet:
List接口:(有序,内容可以重复equals) ==比较的是对象的地址,equals比较的是对象内容。
LinkedList:(链表)
ArrayList:(数组)
方法:
(object)set()
add()
remove()
Collections类 提供的静态方法:
sort()排序 默认ASC
shuffle()随机排列
reverse()逆序
fill()
copy()
binarySearch()二分法查找
Comparable接口:
方法:compareTo(Object o)
定义一个类两个对象谁大谁小
Map接口:
HashMap类:(成对存放,key和values,键不能重复(equals))
TreeSet类:二叉树
使用:通过key取得value,键值对作为思想,在hibernate中OGNL中的应用
方法:remove() 移除对象,返回类型布尔类型。
hashCode()
equals()
add()
remove()
Iterator接口:遍历 迭代器 相当于游标
所有实现Collection接口容器类都实现了一个iterator方法 返回了一个实现iterator接口对象
例如:ArrayList()可以很容易找出要找的元素 但是在LinkList中很难找到
方法:
hasNext()是否存在下一个元素
next()
remove()
泛型:
类<E>
接口<T>
简略图如下:
Collection
Set HashSet
List ArrayList LinkedList
MAP HashMap
Iterator --hasNext() next()
Comparable --compareTo(Object)
Collections --shuffle() reverse() size()
总结(口诀):1136
一个图
一个类
【Collections】方法:sort() shuffle() reverse() binarysearch() copy() fill()
三个知识点(不重要)
六个接口 Collection Set List Map Iterator Comparable
附:
Date :(格式转换) java.text.SimpleDateFormate,regxp正则表达式
Calendar:(depreciated)过时
Random:随机数

被折叠的 条评论
为什么被折叠?



