mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add equals
This commit is contained in:
@@ -2,6 +2,7 @@ package cn.hutool.core.lang.tree;
|
||||
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 树节点 每个属性都可以在{@link TreeNodeConfig}中被重命名<br>
|
||||
@@ -129,4 +130,21 @@ public class TreeNode<T> implements Node<T> {
|
||||
this.extra = extra;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
TreeNode<?> treeNode = (TreeNode<?>) o;
|
||||
return Objects.equals(id, treeNode.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user