HashSet HashMap HashTable Vector ArrayList区别

Vector 和 ArrayList

Vector非常类似ArrayList,但是Vector是同步的.Vector它允许所有元素,包括null

ArrayList实现了可变大小的数组。它允许所有元素,包括null。

 

HashMap HashTable

HashTable与HashMap非常类似,除了HashTable是同步的和HashTable不允许null Object作为key或value值.

Hashtable是Dictionary的子类,HashMap是Map接口的一个实现类

 

HashSet TreeSet

  Set是一种不包含重复的元素的Collection,即任意的两个元素e1和e2都有e1.equals(e2)=false,Set最多有一个null元素。   HashSet 允许null 值

TreeSet可对其插入的元素按自然顺序排序(Comparable or Comparator ),TreeSet不允许null值将抛出java.lang.NullPointerException.

 

java.util
Class ArrayList

java.lang.Object
  java.util.AbstractCollection
      java.util.AbstractList
          java.util.ArrayList

Resizable-array implementation of the List interface. Implements all optional list operations, and permits all elements, including null. In addition to implementing the List interface, this class provides methods to manipulate the size of the array that is used internally to store the list. (This class is roughly equivalent to Vector, except that it is unsynchronized.)

 

 

java.util
Class HashMap

java.lang.Object
  java.util.AbstractMap
      java.util.HashMap
public class HashMap extends AbstractMap implements Map, Cloneable, Serializable

Hash table based implementation of the Map interface. This implementation provides all of the optional map operations, and permits null values and the null key. (The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls.)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值