Skip to content

Commit b7c9ff2

Browse files
committed
1 parent f9c1c64 commit b7c9ff2

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/main/java/difflib/DiffUtils.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import java.util.List;
3535
import java.util.regex.Matcher;
3636
import java.util.regex.Pattern;
37+
import static java.util.stream.Collectors.joining;
3738

3839
/**
3940
* Implements the difference and patching engine
@@ -132,17 +133,7 @@ public static Patch<String> diffInline(String original, String revised) throws D
132133
}
133134

134135
private static List<String> compressLines(List<String> lines, String delimiter) {
135-
StringBuilder b = new StringBuilder();
136-
for (String line : lines) {
137-
b.append(line);
138-
b.append(delimiter);
139-
}
140-
if (b.length() > 0) {
141-
b.setLength(b.length() - delimiter.length());
142-
return Collections.singletonList(b.toString());
143-
} else {
144-
return Collections.EMPTY_LIST;
145-
}
136+
return Collections.singletonList(lines.stream().collect(joining(delimiter)));
146137
}
147138

148139
/**

0 commit comments

Comments
 (0)