/** * Save the state of the <tt>ConcurrentHashMap</tt> instance to a stream * (i.e., serialize it). * * @serialData The <i>capacity</i> of the ConcurrentHashMap(the length of * the bucket array) is emitted(int), followed by the <i>size</i> of the * ConcurrentHashMap(the number of key-value mappings), followed by the key * (Object) and value(Object) for each key-value mapping represented by the * ConcurrentHashMap The key-value mappings are emitted in the order that * they are returned by <tt>entrySet().iterator()</tt>. */ private void writeObject(ObjectOutputStream s) throws IOException { // Write out the threshold, loadfactor, and any hidden stuff s.defaultWriteObject(); // Write out number of buckets s.writeInt(table.length); // Write out size(number of Mappings) s.writeInt(size); s.writeInt(maxSize); // Write out keys and values(alternating) for (Iterator i = entrySet().iterator(); i.hasNext();) { Map.Entry e = (Map.Entry) i.next(); s.writeObject(e.getKey()); s.writeObject(e.getValue()); } }
/** * Save the state of the <tt>ConcurrentHashMap</tt> instance to a stream * (i.e., serialize it). * * @serialData The <i>capacity</i> of the ConcurrentHashMap(the length of * the bucket array) is emitted(int), followed by the <i>size</i> of the * ConcurrentHashMap(the number of key-value mappings), followed by the key * (Object) and value(Object) for each key-value mapping represented by the * ConcurrentHashMap The key-value mappings are emitted in the order that * they are returned by <tt>entrySet().iterator()</tt>. */ private void writeObject(ObjectOutputStream s) throws IOException { // Write out the threshold, loadfactor, and any hidden stuff s.defaultWriteObject(); // Write out number of buckets s.writeInt(table.length); // Write out size(number of Mappings) s.writeInt(size); s.writeInt(maxSize); // Write out keys and values(alternating) for (Iterator i = entrySet().iterator(); i.hasNext();) { Map.Entry e = (Map.Entry) i.next(); s.writeObject(e.getKey()); s.writeObject(e.getValue()); } }
/** * Save the state of the <tt>ConcurrentHashMap</tt> instance to a stream * (i.e., serialize it). * * @serialData The <i>capacity</i> of the ConcurrentHashMap(the length of * the bucket array) is emitted(int), followed by the <i>size</i> of the * ConcurrentHashMap(the number of key-value mappings), followed by the key * (Object) and value(Object) for each key-value mapping represented by the * ConcurrentHashMap The key-value mappings are emitted in the order that * they are returned by <tt>entrySet().iterator()</tt>. */ private void writeObject(ObjectOutputStream s) throws IOException { // Write out the threshold, loadfactor, and any hidden stuff s.defaultWriteObject(); // Write out number of buckets s.writeInt(table.length); // Write out size(number of Mappings) s.writeInt(size); s.writeInt(maxSize); // Write out keys and values(alternating) for (Iterator i = entrySet().iterator(); i.hasNext();) { Map.Entry e = (Map.Entry) i.next(); s.writeObject(e.getKey()); s.writeObject(e.getValue()); } }