Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Threadsafety  RSS feed

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could somebody give me an overview of thread safety of data structures that use Iterators and data structures that use Enumerators?
Thanks.
 
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A class' thread-safetyness or otherwise is typically mentioned in its API documentation. For example, the API for the LinkedList class says:


Note that this implementation is not synchronized. If multiple threads access a list concurrently, and at least one of the threads modifies the list structurally, it must be synchronized externally.



There are also methods in the Collections class (note: not the Collection interface) to return synchronised Lists, Maps, and Sets.

The API docs are online at http://java.sun.com/api
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!