@@ -54,7 +54,7 @@ public static void withDefaultDiffAlgorithmFactory(DiffAlgorithmFactory factory)
5454 */
5555 public static <T > Patch <T > diff (
5656 List <? extends T > original , List <? extends T > revised , DiffAlgorithmListener progress ) {
57- return DiffUtils . diff (original , revised , DEFAULT_DIFF .create (), progress );
57+ return diff (original , revised , DEFAULT_DIFF .create (), progress );
5858 }
5959
6060 /**
@@ -66,7 +66,7 @@ public static <T> Patch<T> diff(
6666 * @return The patch describing the difference between the original and revised sequences. Never {@code null}.
6767 */
6868 public static <T > Patch <T > diff (List <? extends T > original , List <? extends T > revised ) {
69- return DiffUtils . diff (original , revised , DEFAULT_DIFF .create (), null );
69+ return diff (original , revised , DEFAULT_DIFF .create (), null );
7070 }
7171
7272 /**
@@ -79,7 +79,7 @@ public static <T> Patch<T> diff(List<? extends T> original, List<? extends T> re
7979 * @return The patch describing the difference between the original and revised sequences. Never {@code null}.
8080 */
8181 public static <T > Patch <T > diff (List <? extends T > original , List <? extends T > revised , boolean includeEqualParts ) {
82- return DiffUtils . diff (original , revised , DEFAULT_DIFF .create (), null , includeEqualParts );
82+ return diff (original , revised , DEFAULT_DIFF .create (), null , includeEqualParts );
8383 }
8484
8585 /**
@@ -91,7 +91,7 @@ public static <T> Patch<T> diff(List<? extends T> original, List<? extends T> re
9191 * @return The patch describing the difference between the original and revised strings. Never {@code null}.
9292 */
9393 public static Patch <String > diff (String sourceText , String targetText , DiffAlgorithmListener progress ) {
94- return DiffUtils . diff (Arrays .asList (sourceText .split ("\n " )), Arrays .asList (targetText .split ("\n " )), progress );
94+ return diff (Arrays .asList (sourceText .split ("\n " )), Arrays .asList (targetText .split ("\n " )), progress );
9595 }
9696
9797 /**
@@ -109,9 +109,9 @@ public static Patch<String> diff(String sourceText, String targetText, DiffAlgor
109109 public static <T > Patch <T > diff (
110110 List <? extends T > source , List <? extends T > target , BiPredicate <? super T , ? super T > equalizer ) {
111111 if (equalizer != null ) {
112- return DiffUtils . diff (source , target , DEFAULT_DIFF .create (equalizer ));
112+ return diff (source , target , DEFAULT_DIFF .create (equalizer ));
113113 }
114- return DiffUtils . diff (source , target , DEFAULT_DIFF .create ());
114+ return diff (source , target , DEFAULT_DIFF .create ());
115115 }
116116
117117 public static <T > Patch <T > diff (
@@ -162,5 +162,44 @@ public static <T> Patch<T> diff(
162162 return diff (original , revised , algorithm , null );
163163 }
164164
165+
166+ /**
167+ * Computes the difference between the given texts inline. Splits the texts
168+ * into tokens and delegates to the default diff algorithm.
169+ *
170+ * @param original the original text. Must not be {@code null}.
171+ * @param revised the revised text. Must not be {@code null}.
172+ * @return The patch describing the difference between the original and revised texts.
173+ */
174+ public static Patch <String > diffInline (String original , String revised ) {
175+ return InlineDiffUtils .diffInline (original , revised );
176+ }
177+
178+ /**
179+ * Applies the given patch to the original list and returns the revised list.
180+ *
181+ * @param <T> the type of elements in the lists.
182+ * @param original the original list. Must not be {@code null}.
183+ * @param patch the patch to apply. Must not be {@code null}.
184+ * @return the revised list.
185+ * @throws com.github.difflib.patch.PatchFailedException if the patch cannot be applied.
186+ */
187+ public static <T > List <T > patch (List <? extends T > original , Patch <T > patch )
188+ throws com .github .difflib .patch .PatchFailedException {
189+ return PatchUtils .patch (original , patch );
190+ }
191+
192+ /**
193+ * Applies the given patch in reverse to the revised list and returns the original list.
194+ *
195+ * @param <T> the type of elements in the lists.
196+ * @param revised the revised list. Must not be {@code null}.
197+ * @param patch the patch to reverse-apply. Must not be {@code null}.
198+ * @return the reconstructed original list.
199+ */
200+ public static <T > List <T > unpatch (List <? extends T > revised , Patch <T > patch ) {
201+ return PatchUtils .unpatch (revised , patch );
202+ }
203+
165204 private DiffUtils () {}
166205}
0 commit comments