KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > collections > test > TestEntity


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: TestEntity.java,v 1.13 2006/10/30 21:14:39 bostic Exp $
7  */

8
9 package com.sleepycat.collections.test;
10
11 /**
12  * @author Mark Hayes
13  */

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 JavaDoc o) {
26
27         try {
28             TestEntity e = (TestEntity) o;
29             return e.key == key && e.value == value;
30         } catch (ClassCastException JavaDoc e) {
31             return false;
32         }
33     }
34
35     public int hashCode() {
36
37         return key;
38     }
39
40     public String JavaDoc toString() {
41
42         return "[key " + key + " value " + value + ']';
43     }
44 }
45
Popular Tags