0% found this document useful (0 votes)
8 views2 pages

6 1collections-Task1

The document outlines four programming tasks involving data structures in Java. It includes creating a HashSet for storing unique student information, a custom Collection for managing city-state mappings, a List for storing and sorting movie details, and a Collection for managing employee records with sorting capabilities. Each task emphasizes the importance of avoiding duplicates and utilizing appropriate Java Collection Framework classes.

Uploaded by

Suresh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

6 1collections-Task1

The document outlines four programming tasks involving data structures in Java. It includes creating a HashSet for storing unique student information, a custom Collection for managing city-state mappings, a List for storing and sorting movie details, and a Collection for managing employee records with sorting capabilities. Each task emphasizes the importance of avoiding duplicates and utilizing appropriate Java Collection Framework classes.

Uploaded by

Suresh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1. WAP to store the information of students in a HashSet which include name and age.

Make sure that no duplicate Students are getting added into the Collection.
Student Class will encapsulate age, firstname, lastname and adderess
Data type of address is Address.java There is HAS-A relationship between Student and
Address.
If 2 Students are having same FULLNAME and same Address then only consider those
2 Students as Equal, otherwise not.

2. Write a class CityStateMap by using child class of java.util.Collection. This mapping class
will allow the user to add new city-state pair in to it. User can get the state of the city by
calling get method on this class. Duplicate city entries are not allowed, in such case
previous mapping should be replaced with new one. Assume that there is a text file
having city state values (in string). Read this file and store these values using
CityStateMap class. Let user do the following operations with this class:

1. Get all cities


2. Get All states
3. Get cities for a state
4. Add new city state pair
5. Delete all the cities for a given state

3. WAP to store the information of Movies in a List which include name,


language,releaseDate,director,producer, duration.
Use Comparable interface to sort the movies according to their language.
Also use Comparator interface to sort the movies according to the director.
Public List<Movie> createMovieSet()
Public void sortByLanguage(List<Student> movieList)
Public void sortByDuration(List<Student> movieList)
4. Create more than 5 Employees and store it in a suitable collection.
Employee encapsulates information like empid, firstname and lastname.
Make use of an appropriate Collection Framework class so that
Employees can be easily sorted on basis of either empid or firstname.
Collection should not contain any duplicate Employee in it.

You might also like