Skip to content

Commit 749d76e

Browse files
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent d4d8f17 commit 749d76e

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

java-diff-utils/src/main/java/com/github/difflib/DiffUtils.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,5 +162,40 @@ public static <T> Patch<T> diff(
162162
return diff(original, revised, algorithm, null);
163163
}
164164

165+
/**
166+
* Computes the difference between the given texts inline.
167+
*
168+
* @param original a {@link String} representing the original text. Must not be {@code null}.
169+
* @param revised a {@link String} representing the revised text. Must not be {@code null}.
170+
* @return The patch describing the difference between the original and revised texts. Never {@code null}.
171+
*/
172+
public static Patch<String> diffInline(String original, String revised) {
173+
return InlineDiffUtils.diffInline(original, revised);
174+
}
175+
176+
/**
177+
* Applies the given patch to the original list and returns the revised list.
178+
*
179+
* @param original a {@link List} representing the original list.
180+
* @param patch a {@link Patch} representing the patch to apply.
181+
* @return the revised list.
182+
* @throws com.github.difflib.patch.PatchFailedException if the patch cannot be applied.
183+
*/
184+
public static <T> List<T> patch(List<? extends T> original, Patch<T> patch)
185+
throws com.github.difflib.patch.PatchFailedException {
186+
return PatchUtils.patch(original, patch);
187+
}
188+
189+
/**
190+
* Applies the given patch to the revised list and returns the original list.
191+
*
192+
* @param revised a {@link List} representing the revised list.
193+
* @param patch a {@link Patch} representing the patch to apply.
194+
* @return the original list.
195+
*/
196+
public static <T> List<T> unpatch(List<? extends T> revised, Patch<T> patch) {
197+
return PatchUtils.unpatch(revised, patch);
198+
}
199+
165200
private DiffUtils() {}
166201
}

0 commit comments

Comments
 (0)