📜  数组与向量 - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:17.857000             🧑  作者: Mango

代码示例2
- Array contains similar data type. Vector can store heterogeneous data types,
if restriction is not put using generics concept.
- Array has primitive data type, does not belong to Collection family.
Vector implements List interface which is a part of collection hierarchy.
- Array is static and needs to be assigned with the fixed size during
initialization. Vector resizes itself dynamically as per the need. So, 
it is dynamic in nature.
- Array is non-synchronized. Vector is synchronized.
- Array can be traversed using for loop or enhanced for loop. It cannot use
iterator or enumeration interface. Vector can be traversed using iterator 
or enumeration interface.