1 19 package org.netbeans.mdr.util; 20 21 import java.util.Map ; 22 23 public class MapEntryImpl implements Map.Entry { 24 25 private Object key; 26 private Object value; 27 28 public MapEntryImpl(Object key, Object value) { 29 this.key = key; 30 this.value = value; 31 } 32 33 public Object getValue () { 34 return value; 35 } 36 37 public Object getKey () { 38 return key; 39 } 40 41 public Object setValue (Object value) { 42 throw new UnsupportedOperationException (); 43 } 44 45 public boolean equals (Object o) { 46 if (o instanceof Map.Entry ) { 47 Map.Entry e = (Map.Entry ) o; 48 return (key == null ? e.getKey() == null : e.getKey().equals(key)) && 49 (value == null ? e.getValue() == null : e.getValue().equals(value)); 50 51 } else { 52 return false; 53 } 54 } 55 56 public int hashCode () { 57 return (key == null ? 0 : key.hashCode()) ^ (value == null ? 0 : value.hashCode()); 58 } 59 60 } 61 | Popular Tags |