1.Collection 接口下的List和Set2.Map 接口下的hashMap 和TreeMap List 和Set的区别。List 允许重复的元素存在,Set不可以存在重复的元素。set中不允许存在重复的元素通过hashCode 和equals 方法来确定,只有当hashCode 相同的时....
分类:
编程语言 时间:
2014-12-01 00:43:21
阅读次数:
215
读完本文,你会了解到: 1. HashMap的设计思路和内部结构组成
2. HashMap中的一些概念: 什么是阀值?为什么会有阀值?什么是加载因子?它们有什么作用?
3. HashMap的性能问题以及使用事项
4. HashMap的源码实现解析
5. 为什么JDK建议我们重写Object.equals(Object obj)方法时,需要保证对象可以返回相同的hashcode值?...
分类:
编程语言 时间:
2014-11-30 15:34:12
阅读次数:
281
Path Sum IIGiven a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tr...
分类:
其他好文 时间:
2014-11-29 17:29:14
阅读次数:
184
1 == 对于基本数据类型,根据两端的值来判断是否相等,即使两端的数据类型不同,也可以返回true。引用数据类型,比较引用变量类型的地址是否相等 2 equals()是比较引用类型变量是否相等,也是比较地址值 3 ctrl+shift+t 查看源码 package lianxi2; public c...
分类:
其他好文 时间:
2014-11-29 15:50:44
阅读次数:
103
Path SumGiven 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 give...
分类:
其他好文 时间:
2014-11-29 15:49:23
阅读次数:
135
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum =...
分类:
其他好文 时间:
2014-11-29 13:03:14
阅读次数:
180
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.Fo...
分类:
其他好文 时间:
2014-11-29 11:37:32
阅读次数:
131
随笔分类 - JavaJava集合框架总结(5)——Map接口的使用摘要: Map用于保存具有映射关系的数据(key-vlaue)。Map的key不允许重复,即同一个Map对象的任何两个key通过equals方法比较总是返回falseMap中包含了一个keySet()方法,用于返回Map所以key组...
分类:
编程语言 时间:
2014-11-28 16:15:47
阅读次数:
228
1. 要比较两个基本类型的数据或者两个引用变量是否相等(equals方法比较的是变量的内容),只能用“==”操作符;
2. String a = new String("foo");
String b = new String("foo");
如果是a==b,则返回false,因为==比较的是两个引用变量是否指向同一个对象,即这两个变量所对应的内存中的数值是否相等,即对象占用的那块内...
分类:
其他好文 时间:
2014-11-28 10:17:43
阅读次数:
148
4,字符串提供的各种方法1)Length:获得当前字符串中字符的个数。2)ToUpper():将字符串转换成大写形式。3)ToLower(): 将字符串转换成小写形式。4)Equals(str2,StringComparison.OrdianlIgnoreCase):比较两个字符串,可以忽略大小写。...
分类:
其他好文 时间:
2014-11-26 20:33:58
阅读次数:
215