Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. @Override
  2. public int hashCode() {
  3. final int prime = 31;
  4. int result = super.hashCode();
  5. result = prime * result + ((codigo == null) ? 0 : codigo.hashCode());
  6. result = prime * result + ((tamanho == null) ? 0 : tamanho.hashCode());
  7. return result;
  8. }
  9.  
  10.  
  11. @Override
  12. public boolean equals(Object obj) {
  13. if (this == obj)
  14. return true;
  15. if (!super.equals(obj))
  16. return false;
  17. if (getClass() != obj.getClass())
  18. return false;
  19. ProdutoComTamanho other = (ProdutoComTamanho) obj;
  20. if (codigo == null) {
  21. if (other.codigo != null)
  22. return false;
  23. } else
  24. return false;
  25. if (tamanho == null) {
  26. if (other.tamanho != null)
  27. return false;
  28. } else if (!tamanho.equals(other.tamanho) && !codigo.equals(other.codigo))
  29. return false;
  30. return true;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement