Hi
Answer says : All modification operations of a CopyOnWriteArrayList are considered atomic.
Just to clarify - all modifications ( i.e. add() ) or modifications that write multiple elements (i.e. addAll() ) will be atomic?
About Question enthuware.ocpjp.v8.2.1707 :
Moderator: admin
-
- Posts: 197
- Joined: Mon Jun 20, 2016 5:06 pm
- Contact:
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1707 :
Yes, that is correct.
-
- Posts: 197
- Joined: Mon Jun 20, 2016 5:06 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1707 :
Sorry, which statement is correct?
a) all modifications ( i.e. add() )
or
b) modifications that write multiple elements (i.e. addAll() )
I believe it is option b only.
a) all modifications ( i.e. add() )
or
b) modifications that write multiple elements (i.e. addAll() )
I believe it is option b only.
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1707 :
Well, all modifications include all modifications even though it doesn't make much sense for a single modification. A single modification is, nevertheless, atomic.
-
- Posts: 197
- Joined: Mon Jun 20, 2016 5:06 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1707 :
But batch of single modifications run from one method would not block, correct?
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1707 :
Not sure what you mean. Please post code.
Who is online
Users browsing this forum: Bing [Bot] and 4 guests