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:
@@ -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;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import com.samskivert.util.HashIntMap;
|
||||
|
||||
@@ -47,11 +48,10 @@ public class StreamableHashIntMap extends HashIntMap
|
||||
{
|
||||
int ecount = size();
|
||||
out.writeInt(ecount);
|
||||
Iterator iter = keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
int key = ((Integer)iter.next()).intValue();
|
||||
out.writeInt(key);
|
||||
out.writeObject(get(key));
|
||||
for (Iterator iter = entrySet().iterator(); iter.hasNext(); ) {
|
||||
Map.Entry entry = (Map.Entry) iter.next();
|
||||
out.writeInt(((Integer) entry.getKey()).intValue());
|
||||
out.writeObject(entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user