Optaplanner Joiners.equal not using .equals?

问题描述 投票:1回答:1

我以以下方式开始在我的OptaPlanner项目中定义一个约束(使用Constraint-Stream-API:

factory.from(Lesson.class)
        .join(Lesson.class, equal(Lesson::getTimeslot, Lesson::getTimeslot))...

Timeslot类中,我已覆盖equals()方法。在我看来,Joiners.equal似乎不使用此equals方法来比较时隙,因为我使用以下代码得到了不同的结果:

 factory.from(Lesson.class).join(Lesson.class)
        .filter((l,m) -> l.getTimeslot().equals(m.getTimeslot())

有人知道Joiners.equal的比较依据吗?

java optaplanner
1个回答
2
投票

[Joiners.equal依赖于equals() hashCode()

© www.soinside.com 2019 - 2024. All rights reserved.