前面,我们已经系统的对List和Map进行了 学习。接下来,我们开始可以学习Set。相信经过Map的了解之后,学习Set会容易很多。毕竟,Set的实现类都是基于Map来实现的(HashSet 是通过HashMap实现的,TreeSet是通过TreeMap实现的)。首先,我们看看Set架构。(01) ...
分类:
编程语言 时间:
2014-07-22 22:55:33
阅读次数:
213
字符串讲解 参考MSDN方法string.ToLower()string.ToUpper()string.Equals属性:string.length字符串分割: string str = "How are you ?Fine,Thank you?"; s...
分类:
其他好文 时间:
2014-07-16 22:57:15
阅读次数:
207
本文转自http://blog.csdn.net/t12x3456/article/details/7341515(1)对于字符串变量来说,使用“==”和“equals()”方法比较字符串时,其比较方法不同。“==”比较两个变量本身的值,即两个对象在内存中的首地址。“equals()”比较字符串中所...
分类:
编程语言 时间:
2014-07-16 17:45:26
阅读次数:
189
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
1 public void Test(){2 3 var query = from a in A join b in B on A.Id equals B.Id into c4 from d in c.DefaultIfEmpty()5 ...
分类:
其他好文 时间:
2014-07-14 08:43:30
阅读次数:
187
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
【喵"的Android之路】【番外篇】关于==和equals在实际的编程当中,经常会使用==和equals来判断变量是否相同。但是这两种比较方式也常常让人搞得云里雾里摸不着头脑。下面是我个人做的总结,希望能起到拨云见日的作用。【讲前普及】请阅读【喵"的Android之路】【基础篇(一)】【Java面...
分类:
移动开发 时间:
2014-07-13 17:54:48
阅读次数:
293
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
For example:
Given the below binary tree and sum
...
分类:
其他好文 时间:
2014-07-13 13:58:01
阅读次数:
184
方法一:
/** 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
Collection主要的子接口:
List:可以存放重复内容Set:不能存放重复内容,所有重复的内容靠hashCode()和equals()两个方法区分Queue:队列接口SortedSet:可以对集合中的数据进行排序
List接口:
总结了List接口的扩展方法,即包含有增删改查方法.
List接口常用的子类:
ArrayList:可以...
分类:
其他好文 时间:
2014-07-12 19:26:08
阅读次数:
274