Re: HashMaps, hashcodes, equals, and Serialization
- From: "Mike Schilling" <mscottschilling@xxxxxxxxxxx>
- Date: Sat, 30 Dec 2006 19:05:40 GMT
"Siam" <siamraf@xxxxxxxxx> wrote in message
news:1167488849.406980.57250@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
?
2) The contract for hashcode, as written in the API, states "This
integer [the hashcode] need not remain consistent from one execution of
an application to another execution of the same application." Will this
cause complications for when my articles and the hashmap are
serialized, and later deserialized on another execution of my
application? In that, surely if the hashcode is used in determining
where in the table a certain Article object is placed, then if the
hashcode for the Article (when deserialized) changes on another
execution of the application, would the hashmap still be able to find
the Article in its previous place? Or does
serialization/deserialization maintain the hashcode of the object?
During deserialization, the keys are rehashed and the hash chains rebuilt
from scratch, so the new hash table is correct even though the hash values
have changed.
.
- References:
- Prev by Date: Re: Non-Blocking Socket and BufferedInputStream
- Next by Date: Speed of interfaces vs inheritance
- Previous by thread: Re: HashMaps, hashcodes, equals, and Serialization
- Next by thread: Re: HashMaps, hashcodes, equals, and Serialization
- Index(es):
Relevant Pages
|