如果我有ConcurrentLinkedQueue,使用流来删除同一列表中的某些元素是否安全?
例如:
Queue<MyThread> threadList = new ConcurrentLinkedQueue<MyThread>();
//concurrently add and execute some threads to this list
//then we call this concurrently to remove done threads from the thread list
threadList.stream().filter( MyThread::isDone ).forEach( threadList::remove );