`

ArrayList与Vector、HashMap与HashTable

    博客分类:
  • Java
阅读更多

摘自api:

1、ArrayList与Vector:

原文:This class(ArrayList) is roughly equivalent to Vector, except that it is unsynchronized.

ArrayList是不同步的,Vector是同步的,在多线程环境中Vector更安全。如果在程序程序中不需要考虑线程安全,推荐使用ArrayList来代替Vector。

 

2、HashMap与HashTable:

原文:The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls.

HashMap可以除了不是同步的,并且允许null值来作为键值和元素值外,可以大致看做HashTable。HashTable不允许使用null值来作为键值和元素值。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics