java HashSet去重示例
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
public class HashSetDemo {
public static void main(String[] args){
List tableList = new ArrayList();
tableList.add("hello");
tableList.add("hell0");
tableList.add("world");
tableList.add("world");
tableList.add(2);
tableList.add(2);
tableList.add(true);
tableList.add(true);
HashSet hs = new HashSet(tableList);
//System.out.println(hs.toString());
//System.out.println(tableList);
Iterator i = hs.iterator();
while(i.hasNext()){
Object temp = i.next();
System.out.println(temp.toString());
}
}
}
输出:
2
true
hell0
hello
world
相关文档:
关键字: zip gzip
zip扮演着归档和压缩两个角色;gzip并不将文件归档,仅只是对单个文件进行压缩,所以,在UNIX平台上,命令tar通常用来创建一个档案文件,然后命令gzip来将档案文件压缩。
Java
I/O类库还收录了一些能读写压缩格式流的类。要想提供压缩功能,只要把它们包在已有的I/O类的外面就行了。这些类不是Reader ......
昨天看到一个题目:java异常机制和垃圾处理机制,发现平时用的时候也没太注意,拿过来就用。学习这东西就得不断总结、积累,不然时间长还谁还记得它长啥样。
java异常基本概念就不用说了,
java异常主要分为三类:
1)编译时异常java.lang.Exception
2)运行时异常 java.lang.RuntimeException
&nb ......
摘至Sybase官网:
The caller( ) method calls the stored procedure inoutproc:
create proc inoutproc @id int, @newname varchar(50), @newhome Address,
@oldname varchar(50) output, @oldhome Address output as
select @oldname = name, @oldhome = home from xmp where id=@id
update xmp set name ......
【转】Java中的位运算符
原作者:Rosen Jiang 出处:http://www.blogjava.net/rosen
移位运算符
包括:
“>> 右移”;“<< 左移”;“>>> 无符号右移”
例子:
-5>>3=-1
1111 1111 1111 1111 1111 1111 1111 ......
一.Java虚拟机的生命周期
1.Java虚拟机的责任是负责运行Java程序,启动一个Java程序时,产生一个虚拟机实例,当程序关闭退出,虚拟机实例即随之消亡,每一个程序运行于自己的Java虚拟机实例中。
2.JVM通过调用某个初始类的main()方法运行Java程序
3.Java程序初始类中的main()方法,作为该程序初始线程的起点(Java程序的 ......