dkulagin / google-diff-match-patch

Automatically exported from code.google.com/p/google-diff-match-patch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve Java-Code

GoogleCodeExporter opened this issue · comments

I have prepeared a patch which includes some improvements in Java Code.

Original issue reported on code.google.com by jweberho...@weberhofer.at on 8 Nov 2011 at 3:13

Attachments:

Original comment by neil.fra...@gmail.com on 9 Nov 2011 at 9:36

  • Changed state: Accepted
With respect to the "Garbage collect" line, we've had long discussions about 
that.  Although lint tools will point at that line and scream, it actually does 
serve a useful purpose by telling the garbage collector that those two 
(potentially large) variables can be reclaimed.  This is beneficial given the 
memory-intensive diffing that is to come.

The 'i' variable in diff_prettyHtml is indeed orphaned code.  I've removed it 
from all seven languages.  Good catch.

The 'nullPadding' variable in patch_addPadding has also generated long 
discussions.  This string is only four characters long.  It is faster to build 
it with string concatenation than it is to instantiate a StringBuffer object 
and repeatedly call functions on it.

Regarding blank lines between methods, Java's style guide does say to use only 
one blank line between methods, so I've removed all the double spaces.

Thanks for the hashCode and equals functions.  I've simplified the former a bit.

All changes checked into Subversion.

Original comment by neil.fra...@gmail.com on 10 Nov 2011 at 6:54

  • Changed state: Fixed