Advertisement
Lusien_Lashans

poleznaya shnyaga

Feb 27th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 KB | None | 0 0
  1. public class BlackBox {
  2.     int varA;
  3.     int varB;
  4.    
  5.     BlackBox(int varA, int varB){
  6.         this.varA = varA;
  7.         this.varB = varB;
  8.     }
  9.  
  10.     @Override
  11.     public int hashCode() {
  12.         final int prime = 31;
  13.         int result = 1;
  14.         result = prime * result + varA;
  15.         result = prime * result + varB;
  16.         return result;
  17.     }
  18.  
  19.     @Override
  20.     public boolean equals(Object obj) {
  21.         if (this == obj)
  22.             return true;
  23.         if (obj == null)
  24.             return false;
  25.         if (getClass() != obj.getClass())
  26.             return false;
  27.         BlackBox other = (BlackBox) obj;
  28.         if (varA != other.varA)
  29.             return false;
  30.         if (varB != other.varB)
  31.             return false;
  32.         return true;
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement