小编Abh*_*hek的帖子

Guava与Apache Commons Hash/Equals构建者

我想知道Guava和Apache Commons在equals和hashCode构建器方面的主要区别是什么.

等于:

Apache Commons:

public boolean equals(Object obj) {
    if (obj == null) { return false; }
    if (obj == this) { return true; }
    if (obj.getClass() != getClass()) { return false; }
    MyClass other = (MyClass) obj;
    return new EqualsBuilder()
            .appendSuper(super.equals(obj))
            .append(field1, other.field1)
            .append(field2, other.field2)
            .isEquals();
}
Run Code Online (Sandbox Code Playgroud)

番石榴:

public boolean equals(Object obj) {
    if (obj == null) { return false; }
    if (obj == this) { return true; }
    if (obj.getClass() != getClass()) { return false; } …
Run Code Online (Sandbox Code Playgroud)

java apache-commons guava

13
推荐指数
1
解决办法
9533
查看次数

标签 统计

apache-commons ×1

guava ×1

java ×1