feat(#286): add serializers for mutable collections: ArrayDeque, ArrayBuffer, HashMap, Queue, HashSet #315
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi @novakov-alexey,
I'm completing issue #286 with Scala mutable collection serializers:
scala.collection.mutable.ArrayDequescala.collection.mutable.Buffer&scala.collection.mutable.ArrayBufferscala.collection.mutable.Queuescala.collection.mutable.Map&scala.collection.mutable.HashMapscala.collection.mutable.Set&scala.collection.mutable.HashSetSerializers are implementing de/ser for collection traits (
Buffer,Map,Set, etc...) but there are 2 implicit functions for each serializers: one for the trait (e.i.Buffer) and one for the default implementation (e.i.ArrayBuffer). It allows to serialize any implementation of a collection trait, but there is a drawback at deserialization: the default implementation is instantiated.That's why I've made the choice to implement an
ArrayDequefirst class serializer to keep the benefits of anArrayDequeover a "plain"ArrayBuffer.It may be possible to make things generic like it's done in
CollectionSerializerSnapshotbut it increases state size to serialize class names, etc. so I prefer to keep things simple for this first version. And maybe adding more simple implementations later is a better strategy.