Assignment 5-A

Collections Mastery

Master Java Collections Framework through comprehensive exercises. Work with Lists, Sets, Maps, Generics, and the Streams API to solve complex data manipulation problems.

5-6 hours
Challenging
150 Points
Submit Assignment
What You'll Practice
  • Use List, Set, and Map interfaces
  • Apply generics for type safety
  • Implement streams for data processing
  • Master Collections class utilities
  • Create custom Comparable/Comparator
Contents
01

Assignment Overview

Build a comprehensive Library Management System that utilizes the full power of Java Collections. You'll work with different collection types to manage books, members, and borrowing records.

Skills Applied: Collections Framework (5.1), Generics (5.2), and Streams API (5.3) from Module 5.
Lists & Sets

ArrayList, LinkedList, HashSet, TreeSet

Maps

HashMap, TreeMap, LinkedHashMap

Streams

Filter, map, reduce, collect operations

02

Requirements

Part 1: Book Management with Lists (35 points)

  • Create a Book class implementing Comparable<Book>
  • Use ArrayList<Book> to store library books
  • Implement sorting by title, author, and publication year
  • Create custom Comparator implementations

Part 2: Member Management with Maps (35 points)

  • Create a Member class with unique member ID
  • Use HashMap<String, Member> for member lookup by ID
  • Use TreeMap to maintain sorted member list by name
  • Track borrowed books per member using Map<Member, List<Book>>

Part 3: Unique Categories with Sets (30 points)

  • Use HashSet to track unique book categories
  • Use TreeSet to maintain sorted genre list
  • Implement set operations: union, intersection, difference of book collections

Part 4: Stream Operations (50 points)

  • Filter books by category, year, or availability
  • Map operations to transform book data
  • Calculate statistics: total books, average rating, most borrowed
  • Group books by category using Collectors.groupingBy()
  • Find top 10 most borrowed books using streams
03

Submission Guidelines

Folder Structure: Submit all files in a folder named assignment5_yourname
Required Files:
  1. Book.java - Book model with Comparable
  2. Member.java - Member model
  3. BookComparators.java - Custom comparators
  4. LibraryManager.java - Main logic with collections
  5. StreamOperations.java - Stream-based queries
  6. Main.java - Demo program
  7. README.txt
Ready to submit? Make sure all stream operations are working correctly!
Submit Now
04

Grading Rubric

Criteria Points Description
Book Management (Lists) 35 Proper List usage with Comparable/Comparator
Member Management (Maps) 35 Correct Map implementations and lookups
Category Tracking (Sets) 30 Set operations and uniqueness handling
Stream Operations 50 All stream queries working correctly
Total 150