ArrayList vs. Vectors in Java if thread safety isn't a concern

后端 未结 5 2066
遇见更好的自我
遇见更好的自我 2020-12-01 03:52

Is there really that much of a difference between the performance of Vector and ArrayList? Is it good practice to use ArrayLists at all times when

5条回答
  •  不知归路
    2020-12-01 04:25

    If thread safety isn't an issue you should always use ArrayList. Vector has the overhead of synchronization and it has been shown that the performance differences between ArrayList and Vector are abysmal. You can google for a lot of performance benchmarks.

    Here's one Timing & Performance.

提交回复
热议问题