public final class DiffUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> Patch<T> |
diff(List<T> original,
List<T> revised)
Computes the difference between the original and revised list of elements with default diff algorithm
|
static <T> Patch<T> |
diff(List<T> original,
List<T> revised,
BiPredicate<T,T> equalizer)
Computes the difference between the original and revised list of elements with default diff algorithm
|
static <T> Patch<T> |
diff(List<T> original,
List<T> revised,
DiffAlgorithm<T> algorithm)
Computes the difference between the original and revised list of elements with default diff algorithm
|
static Patch<String> |
diff(String originalText,
String revisedText)
Computes the difference between the original and revised text.
|
static Patch<String> |
diffInline(String original,
String revised)
Computes the difference between the given texts inline.
|
static <T> List<T> |
patch(List<T> original,
Patch<T> patch)
Patch the original text with given patch
|
static <T> List<T> |
unpatch(List<T> revised,
Patch<T> patch)
Unpatch the revised text for a given patch
|
public static <T> Patch<T> diff(List<T> original, List<T> revised) throws DiffException
original - The original text. Must not be null.revised - The revised text. Must not be null.null.DiffExceptionpublic static Patch<String> diff(String originalText, String revisedText) throws DiffException
DiffExceptionpublic static <T> Patch<T> diff(List<T> original, List<T> revised, BiPredicate<T,T> equalizer) throws DiffException
original - The original text. Must not be null.revised - The revised text. Must not be null.equalizer - the equalizer object to replace the default compare algorithm (Object.equals). If null
the default equalizer of the default algorithm is used..null.DiffExceptionpublic static <T> Patch<T> diff(List<T> original, List<T> revised, DiffAlgorithm<T> algorithm) throws DiffException
original - The original text. Must not be null.revised - The revised text. Must not be null.algorithm - The diff algorithm. Must not be null.null.DiffExceptionpublic static Patch<String> diffInline(String original, String revised) throws DiffException
original - revised - DiffExceptionpublic static <T> List<T> patch(List<T> original, Patch<T> patch) throws PatchFailedException
original - the original textpatch - the given patchPatchFailedException - if can't apply patchCopyright © 2009–2017 java-diff-utils. All rights reserved.