+1 vote
in JAVA by (30.8k points)
What does the map() function do? why you use it?

1 Answer

0 votes
by (30.8k points)

The map() function perform map functional operation in Java. This means it can transform one type of object to others by applying a function.

For example, if you have a List of String and you want to convert that to a List of Integer, you can use map() to do so.

Just supply a function to convert String to Integer e.g., parseInt() to map() and it will apply that to all elements of List and give you a List of Integer. In other words, the map can convert one object to another.

Related questions