El metodo hashCode


/ Published in: Java
Save to your folder(s)

metodo para generar hashcodes


Copy this code and paste it in your HTML
  1. int hashCode = 0;
  2.  
  3. @Override
  4. public int hashCode() {
  5. if (this.hashCode == 0) {
  6. return genericHash(this.id_otro_responsable,getId_persona());
  7. }
  8. return id_otro_responsable;
  9. }
  10.  
  11. public static int genericHash(int... fieldHashes) {
  12. int result = 17;
  13. for (int hash : fieldHashes) {
  14. result = 37 * result + hash;
  15. }
  16. return result;
  17. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.