@SuppressWarnings({"MethodWithMultipleLoops"}) public boolean hasChanges() { if (commentsMap.isEmpty()) return false; for (List<Comment> commentList : commentsMap.values()) { for (Comment comment : commentList) { if (comment.isNew()) return true; } } return false; }
@SuppressWarnings({"MethodWithMultipleLoops"}) public String toString() { StringBuffer sb = new StringBuffer(); sb.append('{'); boolean first = true; for (Map.Entry<RelativePosition, List<Comment>> entry : commentsMap.entrySet()) { if (!first) { sb.append(", "); first = false; } sb.append("[").append(entry.getKey()).append(" -> "); for (Comment comment : entry.getValue()) { sb.append(',').append(comment.getText()); } sb.append("]"); } sb.append('}'); return sb.toString(); }
/** Add the specified comment string to the list of trailing comments. */ public void addTrailingComment(String s) { addTrailingComment(Comment.create(s)); }
/** Add the specified comment string to the list of preceding comments. */ public void addPrecedingComment(String s) { addPrecedingComment(Comment.create(s)); }