private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { this.mapType = (MapType) in.readObject(); this.num = 0; this.locked = false; int n = in.readInt(); allocate(getCapacity(n, true)); for (int i = 0; i < n; i++) { String key = ((String) in.readObject()).intern(); double value = in.readDouble(); if (mapType == MapType.SORTED_LIST) { // Assume keys and values serialized in sorted order keys[num] = key; values[num] = value; num++; } else if (mapType == MapType.HASH_TABLE) { put(key, value); } } }