xxxxxxxxxx
# Double all numbers using map and lambda
numbers = (1, 2, 3, 4)
result = map(lambda x: x + x, numbers)
print(list(result))
# output :-
# 1 + 1 = 2 / 2 + 2 = 4 / 3 + 3 = 6 / 4 + 4 = 8
[2, 4, 6, 8]
xxxxxxxxxx
li = [5, 7, 22, 97, 54, 62, 77, 23, 73, 61]
final_list = list(map(lambda x: x*2, li))
print(final_list)
xxxxxxxxxx
# Map function
nums1 = [2,3,5,6,76,4,3,2]
sq = list(map(lambda a : a*a, nums1))
print(sq)
xxxxxxxxxx
# Double all numbers using map and lambda
numbers = (1, 2, 3, 4)
result = map(lambda x: x + x, numbers)
print(list(result))
xxxxxxxxxx
1
List<ActiveUserList> activeUserListDTOs=StreamSupport.stream(userRepository.findAll().spliterator(), false).map(ActiveUserList::new).collect(Collectors.toList());