HashSet的常用Demo
来源:互联网 发布:如何查看淘宝客订单 编辑:程序博客网 时间:2024/06/10 03:41
import java.util.*;
public class Demo
{
public static void main(String[] args){
Set<List<String>> set=new HashSet<List<String>>();
List<String> list=new ArrayList<String>();
list.add("chen");
list.add("zou");
set.add(list);
Iterator it=set.iterator();
while(it.hasNext()){
List<String> s=(List<String>)it.next();//迭代器返回的是Object对象
System.out.println(s.get(0)+" "+s.get(1));
}
}
public class Demo
{
public static void main(String[] args){
Set<List<String>> set=new HashSet<List<String>>();
List<String> list=new ArrayList<String>();
list.add("chen");
list.add("zou");
set.add(list);
Iterator it=set.iterator();
while(it.hasNext()){
List<String> s=(List<String>)it.next();//迭代器返回的是Object对象
System.out.println(s.get(0)+" "+s.get(1));
}
}
}
注意:HashSet语法与ArrayList的语法基本相同,不同的是没有get()这个方法。另外它俩都只属于java.util.Collection,创建对象的时候不能放入Map对象以及java对象
0 0
- HashSet的常用Demo
- HashSet Demo
- List的常用Demo
- HashMap的常用Demo
- 多线程的两个常用demo
- 常用demo 的sql 语句
- echartz常用的图形Demo
- 常用集合※【HashSet】
- java中HashSet介绍与demo
- C# HashSet类常用函数
- Android常用的一些服务demo源码
- android常用的一些服务 demo源码
- 一段常用的加解密代码demo
- ArrayList HashSet的比较,以及HashSet分析
- HashSet的contains方法
- HashSet类的用法
- java HashSet的使用
- hashset,hashmap的区别
- 369Cloud_IDE_V1.1.0新看点
- ADB常用命令
- Linux_Shell脚本基础总结
- iOS开发---根据button获取相对应的cell
- Android延时启动效果+轮播图+点击进入+沉浸式状态栏+按钮点击颜色渐变效果+好看的UI框架
- HashSet的常用Demo
- redis3.0.3 安装与配置
- 纯代码约束使用AoutLayout
- Spring 概述--spring3
- Nginx安装
- Python错误1_zlib module missing
- 立体视觉
- urlget请求
- jquery实现checkbox全选/全不选