MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerTIL/comments/77yhd5/java_hashsett_just_uses_hashmapt_object_behind/doqqyob/?context=3
r/ProgrammerTIL • u/c0d3m0nky • Oct 22 '17
https://imgur.com/a/A26Th
35 comments sorted by
View all comments
Show parent comment
1
Good question. Not an expert either, but I see that HashSet#writeObject starts like this :
private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { // Write out any hidden serialization magic s.defaultWriteObject();
According to the doc of ObjectOutputStream, defaultWriteObject() "writes the non-static and non-transient fields of the current class to this stream."
View all comments
Show parent comment
1
u/almightykiwi Oct 22 '17
Good question. Not an expert either, but I see that HashSet#writeObject starts like this :
According to the doc of ObjectOutputStream, defaultWriteObject() "writes the non-static and non-transient fields of the current class to this stream."