1 回答

TA貢獻1804條經驗 獲得超3個贊
正如@DawoodibnKareem 所問,我將發布解決方案:
總是在其中得到“false”的原因是if ( implsNaConfig.equals(implsNoApto) )因為我的CcustoPrestadorOuImplDTO類沒有equals實現該方法。
所以我編輯了類文件并自動生成了 equals 方法并且它起作用了。
CCustoPrestadorOuImplDTO 類中的 equals 方法:
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CcustoPrestadorOuImplDTO that = (CcustoPrestadorOuImplDTO) o;
return Objects.equals(cdCcusto, that.cdCcusto) &&
Objects.equals(deCcusto, that.deCcusto) &&
Objects.equals(grupoOperativo, that.grupoOperativo) &&
Objects.equals(deGrupoOperativo, that.deGrupoOperativo);
}
這是 HashCode() 方法:
@Override
public int hashCode() {
return Objects.hash(cdCcusto, deCcusto, grupoOperativo, deGrupoOperativo);
}
這真的很簡單,但我什至不認為這是問題的原因。
謝謝大家。
添加回答
舉報