易截截图软件、单文件、免安装、纯绿色、仅160KB

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


相关文档:

利用Java实现压缩与解压缩(zip、gzip)支持中文路径

关键字: zip gzip
zip扮演着归档和压缩两个角色;gzip并不将文件归档,仅只是对单个文件进行压缩,所以,在UNIX平台上,命令tar通常用来创建一个档案文件,然后命令gzip来将档案文件压缩。
Java
I/O类库还收录了一些能读写压缩格式流的类。要想提供压缩功能,只要把它们包在已有的I/O类的外面就行了。这些类不是Reader ......

郭克华老师java视频教程下载地址(J2ME 和J2EE)


1.j2ee
http://0444.xue8xue8.com/computer/program/java/j2eeshuren/00.wmv
http://0444.xue8xue8.com/computer/program/java/j2eeshuren/01.wmv
http://0444.xue8xue8.com/computer/program/java/j2eeshuren/02.wmv
http://0444.xue8xue8.com/computer/program/java/j2eeshuren/03.wmv
http://0444.xue8xue8.com/c ......

java compare 接口

1.比较后,返回0,1,-1 的结果,可以用
   return (thisVal<anotherVal ? -1 : (thisVal==anotherVal ? 0 : 1));
效率更高
以下转自 http://bluelzx.javaeye.com/blog/200987
1.
两种比较接口分析


集合框架

中有两种比较接口:
Comparable
接口和
Comparator
接口。
Compara ......

【转】Java中的位运算符

【转】Java中的位运算符
原作者:Rosen Jiang 出处:http://www.blogjava.net/rosen
移位运算符
    包括:
    “>> 右移”;“<< 左移”;“>>> 无符号右移”
例子:
-5>>3=-1
1111 1111 1111 1111 1111 1111 1111 ......

Java nio 异步套接字


import java.nio.*;   
import java.nio.channel.*;   
import java.io.*;   
public static void copy(File source, File dest) throws IOException {   
 FileChannel in = null,  ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号