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 Details

  • Method Details

    • isEmpty

      public boolean isEmpty()
      Returns true if there are no differences. 如果没有差异返回true。
      Returns:
      true if identical | 如果相同返回true
    • toUnifiedDiff

      public String toUnifiedDiff()
      Returns a unified diff format string. 返回统一差异格式字符串。
      Returns:
      unified diff | 统一差异
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • added

      public List<FileComparator.LineEntry> added()
      Returns the value of the added record component.
      Returns:
      the value of the added record component
    • removed

      public List<FileComparator.LineEntry> removed()
      Returns the value of the removed record component.
      Returns:
      the value of the removed record component
    • changed

      public List<FileComparator.LineChange> changed()
      Returns the value of the changed record component.
      Returns:
      the value of the changed record component