How can we create a synchronized collection from given collection?



How can we create a synchronized collection from given collection?..

Answer / Param Vikram Singh

To create a synchronized collection, use the Collections.synchronizedCollection() method for List-based collections (ArrayList, LinkedList) or Collections.synchronizedSet() and Collections.synchronizedMap() for Set-based collections (HashSet, TreeSet) and Map-based collections (HashMap, TreeMap).

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is the loop in java?

1 Answers  


How TreeMap sorts the objects inside it?? suppose if have include one employee object and one car object. On what basis it will sort?

5 Answers  


What is thread safe java?

1 Answers  


Why singleton is not thread safe?

1 Answers  


what is polymorphism?

5 Answers   Zensar,


Assume a thread has lock on it, calling sleep() method on that thread will release the lock?

1 Answers  


Can an abstract class be a final class?

1 Answers  


Explain java heap space and garbage collection?

1 Answers  


What is the difference between object oriented programming language and object based programming language?

1 Answers  


What is the main functionality of the remote reference layer?

1 Answers  


What is an infinite loop in java? Explain with an example.

1 Answers  


How to convert string to int in java?

1 Answers  


Categories