How to use java.Set

前端 未结 4 1984
误落风尘
误落风尘 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:04

    It's difficult to answer this question with the information given. Nothing looks particularly wrong with how you are using HashSet.

    Well, I'll hazard a guess that it's not a compilation issue and, when you say "getting errors," you mean "not getting the behavior [you] want."

    I'll also go out on a limb and suggest that maybe your Block's equals an hashCode methods are not properly overridden.

提交回复
热议问题