遍历set
来源:互联网 发布:大连民族学院网络 编辑:程序博客网 时间:2024/06/02 02:15
迭代遍历
Set<String> set = new HashSet<String>();Iterator<String> it = set.iterator();while(it.hasNext()){ String str = it.next(); System.out.println(str);}
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
- set遍历
- 遍历set
- 遍历set
- Set遍历
- 遍历Set
- 使用循环遍历Set
- Set的循环遍历
- Set的遍历
- java遍历set
- java 遍历set集合
- java Set 遍历
- java遍历Set集合
- Java遍历Set集合
- java遍历Set集合
- Java遍历Set集合
- 02-mac上修改MySQL密码
- Interface
- Plist 文件详解 (一)
- savefile
- java 图片验证码
- 遍历set
- 时间复杂度
- Python 使用nltk和BeautifulSoup进行数据清理 (去除html tag和转换html entities)
- 持续集成工具
- Binary Tree Level Order Traversal Leetcode Python
- 堆结构(三) - 斜堆的原理与实现
- 自主的文件缓存组件FileCache和被封装的System.Net.Cache
- 图结构(一)- 图的理论基础
- Light is falling on a tree from left side you have to find all the nodes on which this light will fa