对 set集合 的遍历
来源:互联网 发布:mac mini 2017 编辑:程序博客网 时间:2024/06/09 19:54
- 对 set 的遍历
- 1.迭代遍历:
- Set<String> set = new HashSet<String>();
- Iterator<String> it = set.iterator();
- while (it.hasNext()) {
- String str = it.next();
- System.out.println(str);
- }
- 2.for循环遍历:
- for (String str : set) {
- System.out.println(str);
- }
- 优点还体现在泛型 假如 set中存放的是Object
- Set<Object> set = new HashSet<Object>();
- for循环遍历:
- for (Object obj: set) {
- if(obj instanceof Integer){
- int aa= (Integer)obj;
- }else if(obj instanceof String){
- String aa = (String)obj
- }
- ........
- }
0 0
- 对 set集合 的遍历
- Set集合的遍历
- set集合的遍历
- jstl如何对集合的遍历(Map,Set)等
- 对Set的遍历
- 对 set 的遍历
- 对 set 的遍历
- java set集合的遍历
- List、Set集合Map集合的遍历
- 对Map集合的遍历
- list和set集合的遍历
- Java中Map、Set集合的遍历
- list和set集合的遍历
- Map、Set、List集合的遍历
- list和set集合的遍历
- 集合List、Set、Map的遍历方式
- java 遍历set集合
- java遍历Set集合
- windows环境python安装第三方库
- HNOI 2016 D2T1 序列 (sequence)
- appcompat_v7的问题
- android多媒体框架之流媒体框架----base on jellybean(九)
- git 更新单个文件
- 对 set集合 的遍历
- JS基础知识
- Android基础控件-TextView
- eclipse 配置 maven 编译代码
- Error:Cannot change dependencies of configuration 'detachedConfiguration1' after it has been resolve
- ]android多媒体框架之流媒体AHandler消息机制----base on jellybean(十)
- 多线程
- WebService性能测试
- Android之Activity