Created
November 15, 2013 14:20
-
-
Save azusa/7485040 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void writeObject(java.io.ObjectOutputStream s) | |
throws IOException | |
{ | |
// Write out the threshold, loadfactor, and any hidden stuff | |
s.defaultWriteObject(); | |
// Write out number of buckets | |
if (table==EMPTY_TABLE) { | |
s.writeInt(roundUpToPowerOf2(threshold)); | |
} else { | |
s.writeInt(table.length); | |
} | |
// Write out size (number of Mappings) | |
s.writeInt(size); | |
// Write out keys and values (alternating) | |
if (size > 0) { | |
for(Map.Entry<K,V> e : entrySet0()) { | |
s.writeObject(e.getKey()); | |
s.writeObject(e.getValue()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment