There are three kinds of actuaries: those who can count, and those who can't.
I don't understand why you'd delete the first one, isn't that the one you'd want to keep and delete the other 2? You would certainly only want to keep one copy of any that are duplicates, but which one, and why? A Set would only contain one instance per phone number. Why would you delete that from the Set?Mike Dalton wrote:Yes it will show 33, 34, 35, 36, 37, 29, 40 in the Set and 34, 34 will be printed.
I want to remove the first 34 from the Set. Your suggestion is to use a Map?
Iterate the original List backwards.Mike Dalton wrote:. . . I want to remove the first 34 from the Set. . . .
Carey Brown wrote:It's hard to help you without a complete set of requirements.
Have you read the tutorial on Set ?
Mike Dalton wrote:The requirements are all phone numbers should be unique.
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:The requirement could also be to make a list of only the unique numbers.
Don't get me started about those stupid light bulbs. |