SCJA
~Currently preparing for SCJP6
Steve
Magnus Kul wrote:I agree with that [David Newton's suggestion to use a Hashing Collection], but this app is only meant to be used by a small club to keep statistics about their players.
Magnus Kul wrote: I need some good way of iterating through the list of elements and find out if the name of the player the user wants to create already exists in the list. Like player.getName().equals() etc. It's not good enough to check for equality amongst the objects, cause number of goals, minutes played etc. may differ even though they try to add a player with a name that already exists. So I have to check if the playername exists in the list, not the object.
Steve
I need some good way of iterating through the list of elements and find out if the name of the player the user wants to create already exists in the list.
SCJA
~Currently preparing for SCJP6
Magnus Kul wrote:It's not good enough to check for equality amongst the objects, cause number of goals, minutes played etc. may differ even though they try to add a player with a name that already exists.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
SCJA
~Currently preparing for SCJP6
David wrote:
It's kind of hard to read your code, since the code posted appears to be doing several different things. It might be easier to understand what the actual problem is if it was broken out into separate methods, each doing only one small thing, and posting only the code that's causing a problem.
[My Blog]
All roads lead to JavaRanch
She said she got a brazillian. I think owning people is wrong. That is how I learned ... tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
|