5151 */
5252public class DiffRowGenerator {
5353
54+ private static final Pattern SPLIT_PATTERN = Pattern .compile ("\\ s+|[,.\\ [\\ ](){}/\\ \\ *+\\ -#]" );
5455 private final boolean showInlineDiffs ;
5556 private final boolean ignoreWhiteSpaces ;
5657 private final Function <Boolean , String > oldTag ;
@@ -176,7 +177,7 @@ public static Builder create() {
176177 private DiffRowGenerator (Builder builder ) {
177178 showInlineDiffs = builder .showInlineDiffs ;
178179 ignoreWhiteSpaces = builder .ignoreWhiteSpaces ;
179- oldTag = builder .oldTag ;;
180+ oldTag = builder .oldTag ;
180181 newTag = builder .newTag ;
181182 columnWidth = builder .columnWidth ;
182183 mergeOriginalRevised = builder .mergeOriginalRevised ;
@@ -185,10 +186,10 @@ private DiffRowGenerator(Builder builder) {
185186 @ Override
186187 public boolean equals (String original , String revised ) {
187188 if (ignoreWhiteSpaces ) {
188- original = original .trim ().replaceAll ("\\ s+" , " " );
189- revised = revised .trim ().replaceAll ("\\ s+" , " " );
189+ return original .trim ().replaceAll ("\\ s+" , " " ).equals (revised .trim ().replaceAll ("\\ s+" , " " ));
190+ } else {
191+ return original .equals (revised );
190192 }
191- return original .equals (revised );
192193 }
193194 };
194195 }
@@ -386,9 +387,7 @@ public static void wrapInTag(List<String> sequence, int startPosition,
386387 sequence .add (endPosition , generator .apply (false ));
387388 }
388389
389- private static final Pattern SPLIT_PATTERN = Pattern .compile ("\\ s+|[,.\\ [\\ ](){}/\\ \\ *+\\ -#]" );
390-
391- static List <String > splitStringPreserveDelimiter (String str ) {
390+ protected final static List <String > splitStringPreserveDelimiter (String str ) {
392391 List <String > list = new ArrayList <>();
393392 if (str != null ) {
394393 Matcher matcher = SPLIT_PATTERN .matcher (str );
0 commit comments