集合的架构:
学习方法:
学习顶层,使用底层
常用方法:
缺点: Collection没有索引,不能使用循环遍历打印输出。
增强for循环:
缺点:目标只能是集合或者数组,且必须有内容。
含有泛型的方法:
StringBuffer类的方法:
public StringBuffer():无参构造方法
1. public int Capacity();返回当前容量 理论值
2. public int length() 返回长度(字符数) 实际值
public StringBuffer append(String str)
可以把任意类型数据添加到字符串缓冲区里面,并返回字符串缓冲区本身
3. public StringBuffer insert(int offset,String str)
在指定位置把任意类型的数据插入到字符串缓冲区里面,并返回字符串缓冲区本身
4. public StringBuffer deleteCharAt(int index)
删除指定位置字符,并返回本身
5. public StringBuffer delete(int start,int end)
删除从指定位置开始,并从指定位置结束字符,并返回本身
注:包左不包右
StringBuffer的截取功能:注意返回值类型不是StringBuffer
6. public String substring(int start)
7. public String substring(int start,int end)
StringBuffer的替换功能:
8. public StringBuffer replace(int start,int end,String str),从start到end用str替换
StringBuffer的反转功能:
9. public StringBuffer reverse()
StringBuild: 是一个Object类,需要重新每个调用
迭代器:
Iterator<?> it = list.iterator();
while (it.hasNext()){
System.out.println(it.next());
}
队列:先进先出
栈 : 先进后出
数组: 查询快,增删慢
链表: 查询慢,增删快
树