問題タブ [copyonwritearraylist]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - CopyOnWriteArrayList の反復処理中に UnsupportedOperationException が発生しました
本で次のような記述を見つけました。
コピー オン ライト ベースの
Iterator
orListIterator
(追加、設定、削除など) で呼び出された変更メソッドは、 をスローしUnsupportedOperationException
ます。
しかし、次のコードを実行すると、問題なく動作し、UnsupportedOperationException
.
上記のコードにより、次の結果が得られます。
メソッドlist
を使用して指定されたを変更しているときに例外が発生しないのはなぜですか?remove