How to use java.Set

前端 未结 4 1983
误落风尘
误落风尘 2020-12-08 16:33

I\'m trying to make it working for quite some time,but just can\'t seem to get it. I have object Tower built of Block\'s. I\'ve already made it working using arrays, but I w

4条回答
  •  误落风尘
    2020-12-08 17:23

    Did you override equals and hashCode in the Block class?

    EDIT:

    I assumed you mean it doesn't work at runtime... did you mean that or at compile time? If compile time what is the error message? If it crashes at runtime what is the stack trace? If it compiles and runs but doesn't work right then the equals and hashCode are the likely issue.

提交回复
热议问题