JAVA TASK (Collections) HARD
JAVA TASK (Collections) HARD
(A) LIST:
(1) ArrayList - Task: Library Management System.
Objective: Create a library management system using ArrayList to manage books. Implement features to add, remove, and search for books
by title.
Requirements
o Methods to:
▪ Add a book.
3. Implement a main method to demonstrate adding, removing, searching, and displaying books.
Objective: Create a task management system using LinkedList to manage tasks. Implement features to add, remove, update, and display
tasks.
Requirements
o Methods to:
▪ Add a task.
3. Implement a main method to demonstrate adding, removing, updating, and displaying tasks.
(B) SET:
(1) HashSet - Task: Student Enrolment System
Objective: Create a student enrolment system using HashSet to manage enrolled students. Implement features to add students, remove
students, check if a student is enrolled, and display all enrolled students.
Requirements
o Override equals() and hashCode() methods to ensure students are compared by their ID.
o Methods to:
▪ Add a student.
3. Implement a main method to demonstrate adding, removing, checking, and displaying enrolled students.
Objective: Create a playlist management system using LinkedHashSet to manage songs. Implement features to add songs, remove songs,
check if a song is in the playlist, and display all songs in the order they were added.
Requirements
o Override equals() and hashCode() methods to ensure songs are compared by their title and artist.
o Methods to:
▪ Add a song.
3. Implement a main method to demonstrate adding, removing, checking, and displaying songs in the playlist.
(3) TreeSet - Task: Event Management System
Objective: Create an event management system using TreeSet to manage events. Implement features to add events, remove events, check
if an event is present, and display all events in sorted order.
Requirements
(C) MAP:
(1) HashMap - Task: Inventory Management System
Objective: Create an inventory management system using HashMap to manage items and their quantities. Implement features to add
items, update quantities, remove items, and display all items with their quantities.
Requirements
o Override equals() and hashCode() methods to ensure items are compared by their name.
o Methods to:
▪ Remove an item.
3. Implement a main method to demonstrate adding, updating, removing, and displaying items in the inventory.
(2) LinkedHashMap - Task: Order Management System
Objective: Create an order management system using LinkedHashMap to manage customer orders. Implement features to add orders,
remove orders, check if an order is present, and display all orders in the order they were added.
Requirements
o Override equals() and hashCode() methods to ensure orders are compared by their orderId.
o Use a LinkedHashMap<String, Order> to store a collection of orders, with the orderId as the key.
o Methods to:
▪ Add an order.
3. Implement a main method to demonstrate adding, removing, checking, and displaying orders.
Objective: Create a contact management system using TreeMap to manage contacts. Implement features to add contacts, remove
contacts, check if a contact is present, and display all contacts in sorted order by name.
Requirements
o Use a TreeMap<String, Contact> to store a collection of contacts, with the name as the key.
o Methods to:
▪ Add a contact.
3. Implement a main method to demonstrate adding, removing, checking, and displaying contacts.