run2000 / java-immutable-collections

Java immutable array-based collections
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Serialization of built Map and Set implementations #1

Open run2000 opened 7 years ago

run2000 commented 7 years ago

The convention in Java collections has been to implement serialization on all collections. Should do this on this codebase as well.

Probably want a judicious use of transient, writeObject, readObject to avoid serializing technically redundant information, and validating deserialized data, for instance the null comparators, and the empty set/empty map instances.

Could even use proxy objects and feed everything back through the builder on deserialization, though this gets complicated when we have collections inside collections.

run2000 commented 7 years ago

First cut is checked in. Used readObject() for some validations, though haven't made hard guarantees about uniqueness, since this may slow things down.