/* */ public String toString() /* */ { /* 277 */ StringBuilder s = new StringBuilder(); /* 278 */ ObjectIterator i = entrySet().iterator(); /* 279 */ int n = size(); /* */ /* 281 */ boolean first = true; /* */ /* 283 */ s.append("{"); /* */ /* 285 */ while (n-- != 0) { /* 286 */ if (first) first = false; else { /* 287 */ s.append(", "); /* */ } /* 289 */ Reference2ShortMap.Entry e = (Reference2ShortMap.Entry) i.next(); /* */ /* 292 */ if (this == e.getKey()) s.append("(this map)"); /* */ else /* 294 */ s.append(String.valueOf(e.getKey())); /* 295 */ s.append("=>"); /* */ /* 299 */ s.append(String.valueOf(e.getShortValue())); /* */ } /* */ /* 302 */ s.append("}"); /* 303 */ return s.toString(); /* */ }
/* */ public int hashCode() /* */ { /* 259 */ int h = 0; int n = size(); /* 260 */ ObjectIterator i = entrySet().iterator(); /* */ /* 262 */ while (n-- != 0) h += ((Map.Entry) i.next()).hashCode(); /* 263 */ return h; /* */ }
/** * Returns a hash code for this set. * * <p>The hash code of a set is computed by summing the hash codes of its elements. * * @return a hash code for this set. */ public int hashCode() { int h = 0, n = size(); ObjectIterator<K> i = iterator(); K k; while (n-- != 0) { k = i.next(); // We need k because KEY2JAVAHASH() is a macro with repeated evaluation. h += ((k) == null ? 0 : (k).hashCode()); } return h; }
/** * Creates a new tree set using elements provided by a type-specific iterator. * * @param i a type-specific iterator whose elements will fill the set. */ public ObjectRBTreeSet(final ObjectIterator<? extends K> i) { while (i.hasNext()) add(i.next()); }