pblj6 Removed
pblj6 Removed
Experiment 6.1
Student Name: Nikita UID:22BCS16902
Branch: CSE Section/Group:22BCS_IOT_644 ‘A’
Semester: 6 Date of Performance:03/03/25
Subject Name: Project Based Learning Subject Code: 22CSH-352
In Java with Lab
Easy:
1. Aim: Write a program to sort a list of Employee objects (name, age, salary) using
lambda expressions.
2. Objective:
To demonstrate sorting of a list of Employee objects using lambda expressions in
Java.
To implement custom sorting based on name, age, and salary using the Comparator
interface.
3. Implementation/Code:
import java.util.*;
class Employee {
String name;
int age;
double salary;
System.out.println("Before Sorting:");
employees.forEach(Employee::display);
4. OUTPUT:
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
5. Learning Outcomes:
Understand the use of lambda expressions for sorting in Java.
Learn how to implement custom sorting using Comparator with different data
types.
Gain hands-on experience with the sort() method in List.
Explore method references for clean and readable code.
Develop efficient sorting techniques without writing separate comparator classes.