• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

equals method, hash code, and serializing a file

 
pamela jones
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to figure out how to use the equal method and hash code to ensure that my program accepts no duplicates when entering data into the JPanel. I am also trying to figure out how to serialize a file and deserialize it. Any suggestions?
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1). use a java.util.Set to ensure that there are no duplicates. To see how to use .equals() and .hashCode effectively, see Chapter 3 of Effective Java by Joshua Bloch.
2). What do you mean by serailization/deserialization of files? writing serialized objects to files, or sending files across data streams?
 
Kathy Sierra
Cowgirl and Author
Rancher
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy,
I just put up a PDF file of 10 pages on serialization. They are *very* easy to read, but too much to put in a post, and with lots of pictures.

serialization from Head First Java book
It's 400k, and not full printing resolution (that matters because at least half of it is illustrations/graphics).
cheers,
Kathy
-co-author, Head First Java, first in a new book series from O'Reilly
oreilly.com Head First page
-original founder of javaranch
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic