Skip to content

Iterators and comparable

January 24, 2011

Fail safe iterator is the one which does not fail on the structural modification of the collection
Fail fast fails immediately with a concurrent modification exception when the structure is modified after the iterator was created from it.

CopyOnWriteArrayList is an example of getting a fail safe iterator. For fail fast you have array list.
Generally its fail safe because it has a copy of the collection with itself.

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: