Save the state of the RBTreeMap instance to a stream (i.e., serialize it). @serialData The size of the RBTreeMap (the number of key-value mappings) is emitted (int), followed by the key (Object) and value (Object) for each key-value mapping represented by the RBTreeMap.
(java.io.ObjectOutputStream s)
| 1525 | * Comparator). |
| 1526 | */ |
| 1527 | private void writeObject(java.io.ObjectOutputStream s) |
| 1528 | throws java.io.IOException { |
| 1529 | |
| 1530 | // Write out the Comparator and any hidden stuff |
| 1531 | s.defaultWriteObject(); |
| 1532 | |
| 1533 | // Write out size (number of Mappings) |
| 1534 | s.writeInt(size); |
| 1535 | |
| 1536 | // Write out keys and values (alternating) |
| 1537 | for (java.util.Iterator<Map.Entry<K,V>> i = entrySet().iterator(); i.hasNext(); ) { |
| 1538 | Map.Entry<K,V> e = i.next(); |
| 1539 | s.writeObject(e.getKey()); |
| 1540 | s.writeObject(e.getValue()); |
| 1541 | } |
| 1542 | } // writeObject |
| 1543 | |
| 1544 | |
| 1545 |