集合(Collection),StringBuffer , 队列,树

集合的架构

学习方法:

学习层,使用

 

 

 

常用方法:

缺点:  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());
}

 

队列:先进先出

: 先进后出

数组: 查询快,增删慢

 

链表: 查询慢,增删快

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值