java - List.Remove(obj) is removing the incorrect value -


i'm doing code remove 1 line <p:datatable> using commandlink in same line.

xhtml

<p:datatable value="#{demandacontroller.equipefornecedor}"     var="equipe" id="dtequipe" style="width:70%; margin-top:5%">     ...      <p:column headertext="excluir" width="20%">         <p:commandlink value="excluir" actionlistener="#{demandacontroller.removerfuncequipe(equipe)}" update="dtequipe" ></p:commandlink>     </p:column> </p:datatable> 

bean

private list<equipe> equipefornecedor = new arraylist<equipe>();  public void removerfuncequipe(equipe funcionario) {     equipefornecedor.remove(funcionario); } 

the method removerfuncequipe(equipe) called correct item value (inspected)

but...when try remove equipefornecedor.remove(item), removes incorrect value of list. doing wrong??

edit:

public abstract class defaultentity implements serializable {  @override public int hashcode() { final int prime = 31; int result = 1; result = prime * result + (getid() == null ? 0 : getid().hashcode()); return result; }  @override public boolean equals(final object obj) { if (this == obj) {     return true; } if (obj == null) {     return false; } if (getclass() != obj.getclass()) {     return false; } defaultentity other = (defaultentity) obj; if (getid() == null) {     if (other.getid() != null) {     return false;     } } else if (!getid().equals(other.getid())) {     return false; } return true; }  } 

equipe:

public class equipe extends defaultentity { .... } 

the both objects id null, debugging function equals, saw none of if conditions satisfied, , returns true. how fix function?


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -