Hi , I expecting the following to return true.
public class HudsonJob {
private String name;
private String status;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public boolean equals(Object jobName) {
return name.toLowerCase().equals(((String)jobName).toLowerCase());
}
public int hashCode() {
return name.hashCode();
}
}
,
List<HudsonJob> existingJbsLst = hudsonUtil.getAllJobs(); // returns multiple HudsonJob objects in the list.
The statement I'm expecting to return true is :
boolean isExistingJob = existingJbsLst.contains("AnExistingJOB");
is always returning false.
OR
boolean isExistingJob = existingJbsLst.equals("AnExistingJOB");
is also returning false.
What should I add/change in the code to get the expected return value.