A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Getting MEAN with Mongo, Express, Angular, and Node
this week in the
Java in General
When to use shallow copy and deep copy ?
Joined: Nov 06, 2006
Dec 11, 2012 07:20:43
I know concepts about shallow copy and deep copy. Just i want to know when we will go for shallow copy and deep copy ?. Please suggest some examples that would be great.
Jesper de Jong
Joined: Aug 16, 2005
Dec 11, 2012 07:36:19
It depends entirely on what the needs are for the program you are writing - there's no general answer to this question.
I'd avoid copying objects as much as possible - it costs performance and memory. If you make your data objects immutable, you'll never need to copy them.
Java Beginners FAQ
JavaRanch SCJP FAQ
The Java Tutorial
Java SE 8 API documentation
I agree. Here's the link:
subject: When to use shallow copy and deep copy ?
need your help about a cast about cloneable.!!!(jcjp07-Q119)
copies of objects
Doubts in cloning concept.
What is the difference between the deep copy and shallow copy in Object.clone()
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015