static final int DEFAULT_INITIAL_CAPACITY = 1 [] EMPTY_TABLE = {}; //就比较用的 transient Entry[] table = (Entry[]) EMPTY_TABLE;//Entry数组,存放数据的地方 int...
分类:
其他好文 时间:
2015-01-27 23:11:25
阅读次数:
247
/* 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...
分类:
其他好文 时间:
2015-01-27 23:09:49
阅读次数:
206
HashSet,ArrayList,集合,内存泄露
分类:
其他好文 时间:
2015-01-27 21:36:38
阅读次数:
186
描述:
Given an array of integers, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they add up to the targ...
分类:
其他好文 时间:
2015-01-27 20:24:52
阅读次数:
213
描述:
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without
repeating letters for "abcabcbb" is "abc", which the length is ...
分类:
其他好文 时间:
2015-01-27 20:21:40
阅读次数:
149
equals 在Object中源码:public boolean equals(Object obj){ return (this==obj); }equals在各个基本类型的封装类型里各自进行了覆盖。使用时要注意类型一致。
分类:
编程语言 时间:
2015-01-27 18:20:09
阅读次数:
211
试想一个问题:如果我们需要给一个超类的方法实现一种更强的功能,也就是加强版的超类,一般会怎么做?继承?Too young too simple!看看下面的例子:当我们需要一个类,需要HashSet类的所有方法,但是随时需要知道在其创建到目前,已经加入过多少元素,该如何实现?一般使用继承,覆盖add(...
分类:
编程语言 时间:
2015-01-27 10:57:03
阅读次数:
197
一个不包含重复元素的 collection。更确切地讲,set 不包含满足e1.equals(e2) 的元素对 e1 和 e2,并且最多包含一个 null 元素。
在所有构造方法以及 add、equals 和 hashCode 方法的协定上,Set 接口还加入了其他规定,这些规定超出了从 Collection 接口所继承的内容。
Set不能包含重复的元素,它的所有方法都是从Collection...
分类:
其他好文 时间:
2015-01-27 09:26:17
阅读次数:
182
依赖的jar包:javax.ws.rs.jarorg.restlet.jarorg.restlet.ext.jaxrs.jarRestletServer.javaimport java.util.HashSet;import java.util.Set;import javax.ws.rs.core...
分类:
其他好文 时间:
2015-01-26 21:01:15
阅读次数:
182
常用API-Hashtable类及其与HashMap、HashSet的区别
一、Hashtable类
1.概述
Hashtable是一种高级数据结构,实现了一个Key-Value映射的哈希表,用以快速检索数据。Hashtable不仅可以像Vector一样动态存储一系列的对象,而且对存储的每一个值对象(值)都安排与另一个键对象(关键字)相关联,非null对象都可以被使用作为...
分类:
编程语言 时间:
2015-01-26 17:15:59
阅读次数:
221