Câu hỏi được gắn thẻ «concurrentmodification»

10
Tại sao tôi không nhận được java.util.ConcienModificationException trong ví dụ này?
Lưu ý: Tôi nhận thức được Iterator#remove()phương pháp. Trong mẫu mã sau đây, tôi không hiểu tại sao phương thức List.removetrong mainném ConcurrentModificationException, nhưng không phải trong removephương thức. public class RemoveListElementDemo { private static final List<Integer> integerList; static { integerList = new ArrayList<Integer>(); integerList.add(1); integerList.add(2); integerList.add(3); } public static …

Khi sử dụng trang web của chúng tôi, bạn xác nhận rằng bạn đã đọc và hiểu Chính sách cookie và Chính sách bảo mật của chúng tôi.
Licensed under cc by-sa 3.0 with attribution required.