Iterate over the entries and save the key and value without having to

look up the value.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2618 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2003-05-27 23:00:22 +00:00
parent 1176ca526e
commit d407253540
@@ -1,10 +1,11 @@
// //
// $Id: StreamableHashIntMap.java,v 1.1 2003/02/18 03:01:16 mdb Exp $ // $Id: StreamableHashIntMap.java,v 1.2 2003/05/27 23:00:22 ray Exp $
package com.threerings.util; package com.threerings.util;
import java.io.IOException; import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map;
import com.samskivert.util.HashIntMap; import com.samskivert.util.HashIntMap;
@@ -47,11 +48,10 @@ public class StreamableHashIntMap extends HashIntMap
{ {
int ecount = size(); int ecount = size();
out.writeInt(ecount); out.writeInt(ecount);
Iterator iter = keySet().iterator(); for (Iterator iter = entrySet().iterator(); iter.hasNext(); ) {
while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next();
int key = ((Integer)iter.next()).intValue(); out.writeInt(((Integer) entry.getKey()).intValue());
out.writeInt(key); out.writeObject(entry.getValue());
out.writeObject(get(key));
} }
} }