public LinkedList < Patch > patch_deepCopy ( LinkedList < Patch > patches ) { LinkedList < Patch > patchesCopy = new LinkedList < Patch > ( ) ; for ( Patch aPatch : patches ) { Patch patchCopy = new Patch ( ) ; for ( Diff aDiff : aPatch . diffs ) { Diff diffCopy = new Diff ( aDiff . operation , aDiff . text ) ; patchCopy . diffs . add ( diffCopy ) ; } patchCopy . start1 = aPatch . start1 ; patchCopy . start2 = aPatch . start2 ; patchCopy . length1 = aPatch . length1 ; patchCopy . length2 = aPatch . length2 ; patchesCopy . add ( patchCopy ) ; } return patchesCopy ; }
Given an array of patches return another array that is identical .