Lab 5 A
Lab 5 A
State Finished
Completed on Tuesday, 30 April 2024, 2:15 PM
Time taken 3 days 20 hours
Marks 30.00/30.00
Grade 100.00 out of 100.00
Name 730422243022 CHANDRU S
Question 3
Write a program to read a set of strings during runtime using a Hashset S1, LinkedHashSet S2 and
Correct
TreeSet S3 which will be able to store only Strings. Create a printAll() method and pass S1, S2, S3 which
Mark 10.00 out
will print all the elements and observe the inference.
of 10.00
Note: Size of the set is 6.
For example:
Input Result
Infosys HCL Wipro TechMahindra Using HashSet: [HCL, Wipro, Infosys, TechMahindra,
Hexaware Altran Altran, Hexaware]
Using LinkedHashSet: [Infosys, HCL, Wipro, TechMahindra,
Hexaware, Altran]
Using TreeSet: [Altran, HCL, Hexaware, Infosys,
TechMahindra, Wipro]
Krish Ram Venkat Govind Madhav Using HashSet: [Mukund, Krish, Madhav, Govind, Venkat,
Mukund Ram]
Using LinkedHashSet: [Krish, Ram, Venkat, Govind,
Madhav, Mukund]
Using TreeSet: [Govind, Krish, Madhav, Mukund, Ram,
Venkat]
Infosys HCL Wipro Using HashSet: [HCL, Wipro, Using HashSet: [HCL, Wipro,
TechMahindra Infosys, TechMahindra, Infosys, TechMahindra,
Hexaware Altran Altran, Hexaware] Altran, Hexaware]
Using LinkedHashSet: Using LinkedHashSet:
[Infosys, HCL, Wipro, [Infosys, HCL, Wipro,
TechMahindra, Hexaware, TechMahindra, Hexaware,
Altran] Altran]
Using TreeSet: [Altran, HCL, Using TreeSet: [Altran, HCL,
Hexaware, Infosys, Hexaware, Infosys,
TechMahindra, Wipro] TechMahindra, Wipro]
AAA BBB CCC DDD EEE Using HashSet: [AAA, CCC, Using HashSet: [AAA, CCC,
FFF BBB, EEE, DDD, FFF] BBB, EEE, DDD, FFF]
Using LinkedHashSet: [AAA, Using LinkedHashSet: [AAA,
BBB, CCC, DDD, EEE, FFF] BBB, CCC, DDD, EEE, FFF]
Using TreeSet: [AAA, BBB, Using TreeSet: [AAA, BBB,
CCC, DDD, EEE, FFF] CCC, DDD, EEE, FFF]