Why ArrayList class is not a synchronized class and why it
is not a thread safe class? explain

Answer Posted / atre sachin

If multiple threads access an ArrayList instance concurrently, and at least one of the threads modifies the list structurally, it must be synchronized externally. (A structural modification is any operation that adds or deletes one or more elements, or explicitly resizes the backing array; merely setting the value of an element is not a structural modification.)

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is executor memory?

737


Can a class be private in java?

760


What are static blocks and static initalizers in java ?

789


How does arraylist size increase in java?

793


Why are functions called methods in java?

774


What is early binding and late binding in java?

817


How can we create an immutable class in java?

826


Can we clone singleton object in java?

807


What is lazy initialization in java?

764


make a method which any number and any type of argument and print sum of that arguments.....

1597


Is a boolean variable?

750


why are wait(), notify() and notifyall() methods defined in the object class? : Java thread

765


Can abstract class have private constructor?

727


Which class is the superclass of all classes?

852


What is the use of using enum to declare a constant?

796