Skip to content

Commit

Permalink
feat: Add example on map
Browse files Browse the repository at this point in the history
  • Loading branch information
VishwajeetVT committed Nov 29, 2024
1 parent cea54fe commit 7ebea03
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public static void main(String[] args) {
System.out.println(integerToBinary(integerList));

System.out.println(extractFirstLetter(list));

System.out.println(calculateLength(list));
}
// 1. Transforming Elements
public static List<String> upperCaseList(List<String> list) {
Expand Down Expand Up @@ -89,6 +91,13 @@ public static List<String> extractFirstLetter(List<String> list) {
.toList();
}

// Calculate Length of Strings
public static List<Integer> calculateLength(List<String> list) {
return list.stream()
.map(String::length)
.toList();
}

private static class Employee {
private String employeeName;
private int age;
Expand Down

0 comments on commit 7ebea03

Please sign in to comment.