1 package polyglot.util; 2 3 6 public class IdentityKey 7 { 8 Object obj; 9 10 public IdentityKey(Object obj) { 11 this.obj = obj; 12 } 13 14 public Object object() { 15 return obj; 16 } 17 18 public int hashCode() { 19 return System.identityHashCode(obj); 20 } 21 22 public boolean equals(Object other) { 23 return other instanceof IdentityKey 24 && ((IdentityKey) other).obj == obj; 25 } 26 27 public String toString() { 28 return "Id(" + obj + ")"; 29 } 30 } 31 32 | Popular Tags |