I have this Java method which his used to compare data:
org.apache.commons.lang3.builder.Diff;
public void addChangedPositions(DiffrentResult diffrentResult , List<UpdatedPositionsData> updatedPositionsData) {
for (Diff<?> diff : diffResult.getDiffs()) {
UpdatedPositionsData updatedData = new UpdatedPositionsData();
updatedData.setName(diff.getFieldName() == null ? null : diff.getFieldName());
updatedData.setOldValue(diff.getLeft() == null ? null : diff.getLeft().toString());
updatedData.setNewValue(diff.getRight() == null ? null : diff.getRight().toString());
updatedPositionsData.add(updatedField);
}
}
........
@Getter
@Setter
public class UpdatedPositionsData {
private String name;
private String oldValue;
private String newValue;
}
But for this line for (Diff<?> diff : diffResult.getDiffs()) {
I get error:
incompatible types: Object cannot be converted to Diff<?>
So I have:
Required type:
Object
Provided:
Diff
<?>
Do you know how I can fix this issue?
P.S unfortunately the problem is not solved.
I created this small example code:
Can you advise how can be fixed, please?