概要这一章,我们对TreeSet进行学习。我们先对TreeSet有个整体认识,然后再学习它的源码,最后再通过实例来学会使用TreeSet。内容包括:第1部分 TreeSet介绍第2部分 TreeSet数据结构第3部分 TreeSet源码解析(基于JDK1.6.0_45)第4部分 TreeSet遍历方...
分类:
编程语言 时间:
2014-07-22 22:56:13
阅读次数:
307
前面,我们已经系统的对List和Map进行了 学习。接下来,我们开始可以学习Set。相信经过Map的了解之后,学习Set会容易很多。毕竟,Set的实现类都是基于Map来实现的(HashSet 是通过HashMap实现的,TreeSet是通过TreeMap实现的)。首先,我们看看Set架构。(01) ...
分类:
编程语言 时间:
2014-07-22 22:55:33
阅读次数:
213
概要这一章,我们对HashSet进行学习。我们先对HashSet有个整体认识,然后再学习它的源码,最后再通过实例来学会使用HashSet。内容包括:第1部分 HashSet介绍第2部分 HashSet数据结构第3部分 HashSet源码解析(基于JDK1.6.0_45)第4部分 HashSet遍历方...
分类:
编程语言 时间:
2014-07-22 22:54:55
阅读次数:
349
1 public class Solution { 2 public int firstMissingPositive(int[] A) { 3 HashSet hash=new HashSet(); 4 int count=0; 5 int...
分类:
其他好文 时间:
2014-07-15 08:58:16
阅读次数:
239
public class Solution { public int longestConsecutive(int[] num) { HashSet hash=new HashSet(); int max=1; for(int n:num) ...
分类:
其他好文 时间:
2014-07-13 21:52:58
阅读次数:
244
方法一:
/** List order not maintained **/
public static void removeDuplicate(ArrayList arlList)
{
HashSet h = new HashSet(arlList);
arlList.clear();
arlList.addAll(h);
}
方法二:
/** Lis...
分类:
其他好文 时间:
2014-07-12 22:45:06
阅读次数:
241
set集合的一些方法 Set set1=new HashSet(); set1.add("a"); set1.add("b"); set1.add("c"); set1.add("d"); ...
分类:
其他好文 时间:
2014-07-11 11:58:14
阅读次数:
229
给定一个字符串 String s =
"leetcode"
dict =
["leet", "code"].
查看一下是够是字典中的词语组成,如果是返回true,否则返回false。
下边提供3种思路
1.动态算法
import java.util.HashSet;
import java.util.Set;
public class WordBreak1 {
publi...
分类:
编程语言 时间:
2014-07-08 19:24:23
阅读次数:
215
要求:用户从外部导入TXT文件(input textfile),该文件有三列,分别是storeNum,MosrName,MosrNum,如下是一个input textfile的Case:5099,Scoresby,56595250,Scoresby,56595211,Scoresby,5659513...
分类:
其他好文 时间:
2014-07-06 13:12:43
阅读次数:
232
package com.letv.cloud.spider;import java.util.HashSet;import java.util.List;import us.codecraft.webmagic.Page;import us.codecraft.webmagic.Site;impor...
分类:
Web程序 时间:
2014-07-05 18:52:01
阅读次数:
266