Deleting objects from an ArrayList in Java

前端 未结 13 1848
轮回少年
轮回少年 2020-12-15 03:14

I need to delete some objects from an ArrayList if they meet a condition and I\'m wondering which way could be more efficient.

Here\'s the situation: I

相关标签:
13条回答
  • 2020-12-15 04:18

    I'm good with Mnementh's recommentation.
    Just one caveat though,

     ConcurrentModificationException
    

    Mind that you don't have more than one thread running. This exception could appear if more than one thread executes, and the threads are not well synchronized.

    0 讨论(0)
提交回复
热议问题