KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > calipso > reportgenerator > reportcalculator > Entry


1 package com.calipso.reportgenerator.reportcalculator;
2
3 import java.util.Map JavaDoc;
4
5 /**
6  * Asociación Clave-Valor
7  */

8 public class Entry implements Map.Entry JavaDoc, Comparable JavaDoc {
9   Object JavaDoc key;
10   Object JavaDoc value;
11
12   protected Entry(Object JavaDoc key, Object JavaDoc value) {
13     this.key = key;
14     this.value = value;
15   }
16
17   public Object JavaDoc getKey() {
18     return key;
19   }
20
21   public Object JavaDoc getValue() {
22     return value;
23   }
24
25   public Object JavaDoc setValue(Object JavaDoc value) {
26     if (value == null)
27       throw new NullPointerException JavaDoc();
28
29     Object JavaDoc oldValue = this.value;
30     this.value = value;
31     return oldValue;
32   }
33
34   public String JavaDoc toString() {
35     return key.toString() + "=" + value.toString();
36   }
37
38   public int compareTo(Object JavaDoc o) {
39     return key.toString().compareTo(o.toString());
40   }
41 }
42
Popular Tags