本文整理了Java中difflib.Delta.applyTo()
方法的一些代码示例,展示了Delta.applyTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Delta.applyTo()
方法的具体详情如下:
包路径:difflib.Delta
类名称:Delta
方法名:applyTo
[英]Applies this delta as the patch for a given target
[中]将此增量应用为给定目标的修补程序
代码示例来源:origin: com.googlecode.java-diff-utils/diffutils
/**
* Apply this patch to the given target
* @return the patched text
* @throws PatchFailedException if can't apply patch
*/
public List<T> applyTo(List<T> target) throws PatchFailedException {
List<T> result = new LinkedList<T>(target);
ListIterator<Delta<T>> it = getDeltas().listIterator(deltas.size());
while (it.hasPrevious()) {
Delta<T> delta = (Delta<T>) it.previous();
delta.applyTo(result);
}
return result;
}
代码示例来源:origin: com.custardsource.dybdob/java-diff-utils-copy
/**
* Apply this patch to the given target
* @param target
* @return the patched text
* @throws PatchFailedException if can't apply patch
*/
public List<?> applyTo(List<?> target) throws PatchFailedException {
List<Object> result = new LinkedList<Object>(target);
ListIterator<Delta> it = getDeltas().listIterator(deltas.size());
while (it.hasPrevious()) {
Delta delta = (Delta) it.previous();
delta.applyTo(result);
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!