I am just confused. I am trying to get the value of the label in a select list. I tried this:
int approverID = 1;
for(SelectItem s : approverList) {
if(s.getValue().equals(approverID)) {
selectedBlockingConditionRule.setApproverName(s.getLabel());
}
}
and it worked. But when I tried to simplify it and used this:
int approverIndex = this.approverList.indexOf(approverID);
String approverName = this.approverList.get(approverIndex).getLabel();
it returns -1.
I also tried to cast approverID to both Object and Integer but still got -1 for the index. Can you guys help me figure out why this is happening? :(