You forgot to implement hashCode() in a way consistent to equals() :) (I.e. , equal objects must return the same hash code).
Almost certainly true. Poster should really have posted Card. Java for us to be sure.
– Kevin Bourrillion Jun 3 '10 at 0:37 Thanks for the answer, I hadn't implemented hashCode(). Do you have any tips on how I can best implemented hashCode (a card has a the fields face and suit which are both integers)? – Peter Jun 3 '10 at 0:55 Eclipse will auto generate a reasonable hashCode and equals at the same time in 1 click.
– bwawok Jun 3 '10 at 1:45 @Peter, Effective Java 2nd version, Item 9, contains a whole load of tips. Some shortcuts include Arrays.hashCode() (java.sun. Com/javase/6/docs/api/java/util/…)) and Objects.hashCode() (of Guava) (guava-libraries.googlecode.Com/svn/trunk/javadoc/com/google/…...)) Hmm, am I missing a better way to paste links in comments?
– Dimitris Andreou Jun 3 '10 at 2:34.
No it is not. The first rule of debugging Java is that 99.9% of the time it is your code that is broken, and not the Java standard libraries.
You should always override the two together, according to Joshua Bloch's "Effective Java" chapter 3. Post your Card class.It'll be easy to spot then.
It's the same answer as the one that was accepted. – duffymo Jun 3 '10 at 1:43 +1 The squeaky wheel gets the up vote! – DutrowLLC Jun 4 '10 at 21:28.
Please post the code for the Deck class -- at least the equals(Object) and the hashCode() methods. My first guess is that you only implemented equals(), but not hashCode(). If that's the case, read the documentation of the java.lang.
Object class.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.