deepclone

Deep cloning multidimensional arrays in Java... ?

I have two multidimensional arrays (well actually they're only 2D) which have inferred size. How do I deep clone them? Here's what I have gotten so far: public foo(Character[][] original){ clone = new Character[original.length][]; for(int i = 0; i < original.length; i++) clone[i] = (Character[]) original[i].clone(); } A test for...

Can I deep clone a c# object not tagged ICloneable or Serializable?

I have an object not written by myself that I need to clone in memory. The object is not tagged ICloneable or Serializable so deep cloning through the interface or serialization will not work. Is there anyway to deep clone this object? A non-safe win32 API call maybe? ...

What's the best way to make a deep copy of a data structure in Perl?

Given a data structure (e.g. a hash of hashes), what's the clean/recommended way to make a deep copy for immediate use? Assume reasonable cases, where the data's not particularly large, no complicated cycles exist, and readability/maintainability/etc. are more important than speed at all costs. I know I can use Storable, Clone, Clone::M...

Cloning WebService

Is there a way to clone WebService object in as3? The ObjectUtil method seems to throw an error. If not is there a way to cache wsdl and assign it to new WebService object so that constant loading of wsdl can be omitted? ...

I need to implement C# deep copy constructors with inheritance. What patterns are there to choose from?

I wish to implement a deepcopy of my classes hierarchy in C# public Class ParentObj : ICloneable { protected int myA; public virtual Object Clone () { ParentObj newObj = new ParentObj(); newObj.myA = theObj.MyA; return newObj; } } public Class ChildObj : ParentObj { ...

Implementing the ICloneable Interface C#(Question on Deep Cloning)

Hello, I was looking at code that implemented the ICloneable interface for one of the classes. The class was as follows: public class TempClass { String[] names; String[] values; } A partial class was created that implemented TempClass public partial class TempClass:ICloneable { public Object Clone() { TempClass clo...

LinkedHashMap<String,Object>.clone();

does the above command produce a deep copy of a LinkedHashMap's elements? ...

How can I clone FileStream type?

How can I clone FileStream type? The problem is that I using MagickNet.Image(inputStream) to get the image distentions before saving it, but it seems to closing the inputStream. So, I can send a clone of inputStream to the function, so the function cannot edit the real inputStream object? This is my function: public Picture GetPictur...

Copy a table to new window

I'm trying to open up a new browser window, and copy a table from the parent window into this new window. I'm using Prototype.js and this is the code I have: prog_window = window.open(); prog_window.document.write("<html><body></body></html>"); table_clone = Element.clone('prog_table',true); prog_window.document.addElement(table_clone)...

How to deep clone objects containing an IList property using AutoMapper

I am trying to deep clone the following class using AutoMapper: public class MainData { public MainData() { Details = new List<Detail>(); } public int Id { get; private set; } public DateTime LastUpdate { get; private set; } public IList<Detail> Details { get; private set; } public int Prop1 { get; s...

Deep cloning Moose object with attributes that are ArrayRef[Object] and Set::Object

I've got a Moose object: class My::Game { has 'players' => (isa => 'Set::Object', ...) has 'action_sequence' => (isa => 'ArrayRef[My::Game::Action]', ...) } Now I want to be able to clone this object with a call like $game2 = $game->clone; How do I deep clone it so that the objects in the ArrayRef are cloned? And more trickily, th...

Clone a list of reference types that CANNOT implement ICloneable

Is there an easier/tidier way to deep clone a list of reference types that do not implement ICloneable. Currently have been looping through each object in the list like so: Dim myListCopy As New List(Of ListObj) For Each lo As ListObj In MyList myListCopy.Add(lo.ShallowCopy) Next The object ListObj contains only v...