The Artima Developer Community
Sponsored Link

Java Buzz Forum
Reminder: hashcode is not a key

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Christopher Wong

Posts: 128
Nickname: cwong15
Registered: Sep, 2009

Christopher Wong is a senior software engineer at lifeIMAGE.
Reminder: hashcode is not a key Posted: Aug 3, 2011 10:30 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Christopher Wong.
Original Post: Reminder: hashcode is not a key
Feed Title: Chris Wong's Development Blog
Feed URL: http://chriswongdevblog.blogspot.com/feeds/posts/default
Feed Description: This is a development-focused blog covering BlackBerry and Java software development.
Latest Java Buzz Posts
Latest Java Buzz Posts by Christopher Wong
Latest Posts From Chris Wong's Development Blog

Advertisement
I just wanted to share a reminder not to treat Object.hashCode() as a key. This seems very basic, but I have seen experienced developers get tripped up over this method. A number of people seem to think that hashCode can be relied on to return unique integers for each object value, especially for strings. Oops. For example, I saw someone write code that logically works like this: 1

Read: Reminder: hashcode is not a key

Topic: Amazon looking for a game developer? Previous Topic   Next Topic Topic: How to get C like performance in Java

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use