Record Class FileComparator.LineDiff
java.lang.Object
java.lang.Record
cloud.opencode.base.io.file.FileComparator.LineDiff
- Record Components:
added- lines only in file2 with line numbers | 仅在file2中的行及行号removed- lines only in file1 with line numbers | 仅在file1中的行及行号changed- lines that changed between files | 在文件间改变的行
- Enclosing class:
FileComparator
public static record FileComparator.LineDiff(List<FileComparator.LineEntry> added, List<FileComparator.LineEntry> removed, List<FileComparator.LineChange> changed)
extends Record
Result of comparing lines between two files.
两个文件之间行比较的结果。
- Since:
- JDK 25, opencode-base-io V1.2.0
- Author:
- Leon Soo www.LeonSoo.com
-
Constructor Summary
ConstructorsConstructorDescriptionLineDiff(List<FileComparator.LineEntry> added, List<FileComparator.LineEntry> removed, List<FileComparator.LineChange> changed) Creates an instance of aLineDiffrecord class. -
Method Summary
Modifier and TypeMethodDescriptionadded()Returns the value of theaddedrecord component.changed()Returns the value of thechangedrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisEmpty()Returns true if there are no differences.removed()Returns the value of theremovedrecord component.final StringtoString()Returns a string representation of this record class.Returns a unified diff format string.
-
Constructor Details
-
LineDiff
public LineDiff(List<FileComparator.LineEntry> added, List<FileComparator.LineEntry> removed, List<FileComparator.LineChange> changed) Creates an instance of aLineDiffrecord class.
-
-
Method Details
-
isEmpty
public boolean isEmpty()Returns true if there are no differences. 如果没有差异返回true。- Returns:
- true if identical | 如果相同返回true
-
toUnifiedDiff
Returns a unified diff format string. 返回统一差异格式字符串。- Returns:
- unified diff | 统一差异
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
added
-
removed
-
changed
-