Record Class FileComparator.DirectoryDiff

java.lang.Object
java.lang.Record
cloud.opencode.base.io.file.FileComparator.DirectoryDiff
Record Components:
onlyInFirst - paths only in first directory | 仅在第一个目录中的路径
onlyInSecond - paths only in second directory | 仅在第二个目录中的路径
common - paths in both directories | 两个目录中都有的路径
different - common paths with different content | 内容不同的共同路径
Enclosing class:
FileComparator

public static record FileComparator.DirectoryDiff(Set<Path> onlyInFirst, Set<Path> onlyInSecond, Set<Path> common, Set<Path> different) extends Record
Result of comparing two directories. 比较两个目录的结果。
Since:
JDK 25, opencode-base-io V1.2.0
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • DirectoryDiff

      public DirectoryDiff(Set<Path> onlyInFirst, Set<Path> onlyInSecond, Set<Path> common, Set<Path> different)
      Creates an instance of a DirectoryDiff record class.
      Parameters:
      onlyInFirst - the value for the onlyInFirst record component
      onlyInSecond - the value for the onlyInSecond record component
      common - the value for the common record component
      different - the value for the different record component
  • Method Details

    • isIdentical

      public boolean isIdentical()
      Returns true if directories are identical. 如果目录相同返回true。
      Returns:
      true if identical | 如果相同返回true
    • differenceCount

      public int differenceCount()
      Returns the total number of differences. 返回差异总数。
      Returns:
      difference count | 差异数量
    • 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.
    • onlyInFirst

      public Set<Path> onlyInFirst()
      Returns the value of the onlyInFirst record component.
      Returns:
      the value of the onlyInFirst record component
    • onlyInSecond

      public Set<Path> onlyInSecond()
      Returns the value of the onlyInSecond record component.
      Returns:
      the value of the onlyInSecond record component
    • common

      public Set<Path> common()
      Returns the value of the common record component.
      Returns:
      the value of the common record component
    • different

      public Set<Path> different()
      Returns the value of the different record component.
      Returns:
      the value of the different record component