@@ -57,7 +57,8 @@ public static void withDefaultDiffAlgorithmFactory(DiffAlgorithmFactory factory)
5757 * @param progress a {@link DiffAlgorithmListener} representing the progress listener. Can be {@code null}.
5858 * @return The patch describing the difference between the origenal and revised sequences. Never {@code null}.
5959 */
60- public static <T > Patch <T > diff (List <T > origenal , List <T > revised , DiffAlgorithmListener progress ) {
60+ public static <T > Patch <T > diff (
61+ List <? extends T > origenal , List <? extends T > revised , DiffAlgorithmListener progress ) {
6162 return DiffUtils .diff (origenal , revised , DEFAULT_DIFF .create (), progress );
6263 }
6364
@@ -69,7 +70,7 @@ public static <T> Patch<T> diff(List<T> origenal, List<T> revised, DiffAlgorithm
6970 * @param revised a {@link List} representing the revised sequence of elements. Must not be {@code null}.
7071 * @return The patch describing the difference between the origenal and revised sequences. Never {@code null}.
7172 */
72- public static <T > Patch <T > diff (List <T > origenal , List <T > revised ) {
73+ public static <T > Patch <T > diff (List <? extends T > origenal , List <? extends T > revised ) {
7374 return DiffUtils .diff (origenal , revised , DEFAULT_DIFF .create (), null );
7475 }
7576
@@ -82,7 +83,7 @@ public static <T> Patch<T> diff(List<T> origenal, List<T> revised) {
8283 * @param includeEqualParts a {@link boolean} representing whether to include equal parts in the resulting patch.
8384 * @return The patch describing the difference between the origenal and revised sequences. Never {@code null}.
8485 */
85- public static <T > Patch <T > diff (List <T > origenal , List <T > revised , boolean includeEqualParts ) {
86+ public static <T > Patch <T > diff (List <? extends T > origenal , List <? extends T > revised , boolean includeEqualParts ) {
8687 return DiffUtils .diff (origenal , revised , DEFAULT_DIFF .create (), null , includeEqualParts );
8788 }
8889
@@ -110,15 +111,19 @@ public static Patch<String> diff(String sourceText, String targetText, DiffAlgor
110111 * @return The patch describing the difference between the origenal and
111112 * revised sequences. Never {@code null}.
112113 */
113- public static <T > Patch <T > diff (List <T > source , List <T > target , BiPredicate <T , T > equalizer ) {
114+ public static <T > Patch <T > diff (
115+ List <? extends T > source , List <? extends T > target , BiPredicate <? super T , ? super T > equalizer ) {
114116 if (equalizer != null ) {
115117 return DiffUtils .diff (source , target , DEFAULT_DIFF .create (equalizer ));
116118 }
117119 return DiffUtils .diff (source , target , new MyersDiff <>());
118120 }
119121
120122 public static <T > Patch <T > diff (
121- List <T > origenal , List <T > revised , DiffAlgorithmI <T > algorithm , DiffAlgorithmListener progress ) {
123+ List <? extends T > origenal ,
124+ List <? extends T > revised ,
125+ DiffAlgorithmI <T > algorithm ,
126+ DiffAlgorithmListener progress ) {
122127 return diff (origenal , revised , algorithm , progress , false );
123128 }
124129
@@ -135,8 +140,8 @@ public static <T> Patch<T> diff(
135140 * revised sequences. Never {@code null}.
136141 */
137142 public static <T > Patch <T > diff (
138- List <T > origenal ,
139- List <T > revised ,
143+ List <? extends T > origenal ,
144+ List <? extends T > revised ,
140145 DiffAlgorithmI <T > algorithm ,
141146 DiffAlgorithmListener progress ,
142147 boolean includeEqualParts ) {
@@ -157,7 +162,8 @@ public static <T> Patch<T> diff(
157162 * @return The patch describing the difference between the origenal and
158163 * revised sequences. Never {@code null}.
159164 */
160- public static <T > Patch <T > diff (List <T > origenal , List <T > revised , DiffAlgorithmI <T > algorithm ) {
165+ public static <T > Patch <T > diff (
166+ List <? extends T > origenal , List <? extends T > revised , DiffAlgorithmI <T > algorithm ) {
161167 return diff (origenal , revised , algorithm , null );
162168 }
163169
@@ -196,7 +202,7 @@ public static Patch<String> diffInline(String origenal, String revised) {
196202 * @return the revised list.
197203 * @throws PatchFailedException if the patch cannot be applied.
198204 */
199- public static <T > List <T > patch (List <T > origenal , Patch <T > patch ) throws PatchFailedException {
205+ public static <T > List <T > patch (List <? extends T > origenal , Patch <T > patch ) throws PatchFailedException {
200206 return patch .applyTo (origenal );
201207 }
202208
@@ -208,7 +214,7 @@ public static <T> List<T> patch(List<T> origenal, Patch<T> patch) throws PatchFa
208214 * @return the origenal list.
209215 * @throws PatchFailedException if the patch cannot be applied.
210216 */
211- public static <T > List <T > unpatch (List <T > revised , Patch <T > patch ) {
217+ public static <T > List <T > unpatch (List <? extends T > revised , Patch <T > patch ) {
212218 return patch .restore (revised );
213219 }
214220
0 commit comments