0

In a java interview, I was asked what is the different between copy and clone function. What I think both the method are used to make a copy of a object.

Another problem related with clone:

  1. How to make a deep copy of a list and hashmap?
  2. For above question, can we directly call list Object#clone method?

here copy refer to the function present in collections.

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
dead programmer
  • 4,223
  • 9
  • 46
  • 77
  • I haven't heard about a `copy` method in Java Collections framework. – Luiggi Mendoza Aug 30 '14 at 15:46
  • http://stackoverflow.com/questions/1106102/clone-vs-copy-constructor-vs-factory-method and http://stackoverflow.com/questions/2427883/clone-vs-copy-constructor-which-is-recommended-in-java – AntonH Aug 30 '14 at 15:47

0 Answers0