1 52 53 package com.go.trove.util; 54 55 import java.util.*; 56 57 65 public abstract class AbstractMapEntry implements Map.Entry { 66 69 public Object setValue(Object value) { 70 throw new UnsupportedOperationException (); 71 } 72 73 public boolean equals(Object obj) { 74 if (!(obj instanceof Map.Entry)) { 75 return false; 76 } 77 78 Map.Entry e = (Map.Entry)obj; 79 80 Object key = getKey(); 81 Object value = getValue(); 82 83 return 84 (key == null ? 85 e.getKey() == null : key.equals(e.getKey())) && 86 (value == null ? 87 e.getValue() == null : value.equals(e.getValue())); 88 } 89 90 public int hashCode() { 91 Object key = getKey(); 92 Object value = getValue(); 93 94 return 95 (key == null ? 0 : key.hashCode()) ^ 96 (value == null ? 0 : value.hashCode()); 97 } 98 99 public String toString() { 100 return String.valueOf(getKey()) + '=' + String.valueOf(getValue()); 101 } 102 } 103 | Popular Tags |