@Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append('{'); forEachEntry(new TIntObjectProcedure() { private boolean notFirst; public final boolean execute(int key, Object value) { if (this.notFirst) { sb.append(", "); } else { this.notFirst = true; } sb.append(key); sb.append('='); sb.append(value != this ? value : "(this Map)"); return true; } }); return sb.append('}').toString(); }
private void writeObject(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); // number of entries stream.writeInt(_size); SerializationProcedure writeProcedure = new SerializationProcedure(stream); if (! forEachEntry(writeProcedure)) { throw writeProcedure.exception; } }
@Override // GemStoneAddition public int hashCode() { HashProcedure p = new HashProcedure(); forEachEntry(p); return p.getHashCode(); }
/** * Compares this map with another map for equality of their stored * entries. * * @param other an <code>Object</code> value * @return a <code>boolean</code> value */ @Override // GemStoneAddition public boolean equals(Object other) { if (! (other instanceof TIntObjectHashMap)) { return false; } TIntObjectHashMap that = (TIntObjectHashMap)other; if (that.size() != this.size()) { return false; } return forEachEntry(new EqProcedure(that)); }