Java Performance - ArrayLists versus Arrays for lots of fast reads

前端 未结 12 1542
隐瞒了意图╮
隐瞒了意图╮ 2020-12-14 20:20

I have a program where I need to make 100,000 to 1,000,000 random-access reads to a List-like object in as little time as possible (as in milliseconds) for a cellular automa

12条回答
  •  伪装坚强ぢ
    2020-12-14 20:26

    ArrayLists are slower than Arrays, but most people consider the difference to be minor. In your case could matter though, since you're dealing with hundreds of thousands of them.

    By the way, duplicate: Array or List in Java. Which is faster?

提交回复
热议问题