R
Roedy Green
Think about the HashMap inside serialisation writes. It has to keep
track of which objects it has already put into the stream and the
offset where it put them.
You would think it would work with a simple HashMap using the objects
themselves as keys and an Integer or Long offset object.
But the catch is the objects may have equals methods that are not
equivalent to == anymore. That equals could conflate objects that
were different.
I suppose there are two ways it could be implemented -- cannibalise
the code from HashMap using == instead of equals, or using little
pointer objects that point to the object and whose equals method
compares references.
track of which objects it has already put into the stream and the
offset where it put them.
You would think it would work with a simple HashMap using the objects
themselves as keys and an Integer or Long offset object.
But the catch is the objects may have equals methods that are not
equivalent to == anymore. That equals could conflate objects that
were different.
I suppose there are two ways it could be implemented -- cannibalise
the code from HashMap using == instead of equals, or using little
pointer objects that point to the object and whose equals method
compares references.