/** * Returns this SingleFileUnifiedDiff as a List of Strings. * * @return a List of Strings, one String per line of this diff */ public List<String> diffToLines() { List<String> diff = new ArrayList<String>(); diff.addAll(contextInfo); diff.add(originalDiffPath); diff.add(revisedDiffPath); for (UnifiedHunk hunk : hunks) { if (hunk != null) { diff.addAll(hunk.hunkToLines()); } } return diff; }
@Override public String toString() { StringBuilder sb = new StringBuilder(); for (String line : contextInfo) { sb.append(line); sb.append(System.lineSeparator()); } sb.append(originalDiffPath); sb.append(System.lineSeparator()); sb.append(revisedDiffPath); for (UnifiedHunk hunk : hunks) { sb.append(System.lineSeparator()); sb.append(hunk.toString()); } return sb.toString(); }