1 8 9 package com.sleepycat.collections.test; 10 11 14 class TestEntity { 15 16 int key; 17 int value; 18 19 TestEntity(int key, int value) { 20 21 this.key = key; 22 this.value = value; 23 } 24 25 public boolean equals(Object o) { 26 27 try { 28 TestEntity e = (TestEntity) o; 29 return e.key == key && e.value == value; 30 } catch (ClassCastException e) { 31 return false; 32 } 33 } 34 35 public int hashCode() { 36 37 return key; 38 } 39 40 public String toString() { 41 42 return "[key " + key + " value " + value + ']'; 43 } 44 } 45 | Popular Tags |