Tagged articles
6 articles
Page 1 of 1
Architect Chen
Architect Chen
May 7, 2024 · Backend Development

Mastering Java Deep Copy: Techniques, Code Samples, and Best Practices

This article explains Java deep copy, its differences from shallow copy, key use cases such as data safety and avoiding shared state, and demonstrates three implementation methods—using Cloneable, serialization, and third‑party libraries like Guava—complete with runnable code examples.

CloneableGuavadeep copy
0 likes · 7 min read
Mastering Java Deep Copy: Techniques, Code Samples, and Best Practices
Sanyou's Java Diary
Sanyou's Java Diary
Feb 7, 2022 · Backend Development

Understanding Shallow vs Deep Copy in Java: A Practical Cloneable Guide

This article explains the differences between shallow and deep copying in Java, illustrates how the Cloneable interface and the clone() method work, provides complete code examples for both copy types, and clarifies the concept of reference copying with diagrams and test outputs.

CloneableDeepCopyObjectCloning
0 likes · 4 min read
Understanding Shallow vs Deep Copy in Java: A Practical Cloneable Guide
Java Captain
Java Captain
Mar 31, 2018 · Fundamentals

Understanding Object Cloning in Java: Shallow vs Deep Copy

This article explains Java object cloning, detailing why cloning is needed, how to implement shallow and deep copies using the Cloneable interface and serialization, and provides comprehensive code examples illustrating the differences and pitfalls of reference copying.

CloneableJavacloning
0 likes · 15 min read
Understanding Object Cloning in Java: Shallow vs Deep Copy