Video wird geladen...
Video konnte nicht geladen werden
Coding Tip 136: What is a defensive copy? #Java #JavaCodingTip #JavaCoding
34,318 Aufrufe • vor 1 Jahr •via X (Twitter)
4 Kommentare

Kubertvor 1 Jahr
From a recent prod issue, defensive copying is a solid tip for data integrity, but beware of larger arrays. It introduces performance/memory overhead. Consider alternatives like immutable views, lazy copies, or partial copying when size matters. Balance safety & efficiency!

Deepak Lalchandanivor 1 Jahr
Do you have a Java code where you can implement it using record feature in java

diyfvor 1 Jahr
Thanks for sharing that. I wander in which case we want to avoid the defensive copy? Should we be concerned about the memory usage of it? Or should we apply this all the time?

KGvor 1 Jahr
Explaining copy with coffee 😂 Java is my coming from where I live (island). And we have produce great coffee too! What kind of coffee you are drinking?
