Consider a text file of names, with one name per line, that has been compiled from several
Question:
Consider a text file of names, with one name per line, that has been compiled from several different sources. A sample is shown below:
Brooke Trout
Dinah Soars
Jed Dye
Brooke Trout
Jed Dye
Paige Turner
There are duplicate names in the file. We would like to generate an invitation list but don’t want to send multiple invitations to the same person. Write a program that eliminates the duplicate names by using a HashSet. Read each name from the file, add it to the HashSet, and then output all names in the HashSet to generate the invitation list without duplicates.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Question Posted: