集合:可以存储不同类型的多个对象,随着存储对象的个数的增加而自动扩大容量
体系结构:
Collection
|----List:存入的对象是有序的,且可以重复
ArrayList:底层使用的数据结构是数组,线程不安全的,查找速度快,增删速度慢
Vector:底层使用的数据结构是数组,线程安全的,查找速度快,增删速度慢...
分类:
编程语言 时间:
2015-01-29 09:32:34
阅读次数:
258
一.HashSet源代码HashSet的实现对于HashSet而言,它是基于HashMap实现的,HashSet底层采用HashMap来保存所有元素,因此HashSet的实现比较简单,查看HashSet的源代码,可以看到如下代码:Java代码publicclassHashSetextendsAbst...
分类:
编程语言 时间:
2015-01-28 14:34:18
阅读次数:
227
static final int DEFAULT_INITIAL_CAPACITY = 1 [] EMPTY_TABLE = {}; //就比较用的 transient Entry[] table = (Entry[]) EMPTY_TABLE;//Entry数组,存放数据的地方 int...
分类:
其他好文 时间:
2015-01-27 23:11:25
阅读次数:
247
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
试想一个问题:如果我们需要给一个超类的方法实现一种更强的功能,也就是加强版的超类,一般会怎么做?继承?Too young too simple!看看下面的例子:当我们需要一个类,需要HashSet类的所有方法,但是随时需要知道在其创建到目前,已经加入过多少元素,该如何实现?一般使用继承,覆盖add(...
分类:
编程语言 时间:
2015-01-27 10:57:03
阅读次数:
197
依赖的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
package org.cloudbus.cloudsim.core;import java.util.Collection;import java.util.Iterator;import java.util.SortedSet;import java.util.TreeSet;/**执行未来事件...
分类:
其他好文 时间:
2015-01-26 13:32:56
阅读次数:
147