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