Since Java 8, there are some standard options to do this in JDK:

Collection<E> in = ...
Object[] mapped = in.stream().map(e -> doMap(e)).toArray();
// or
List<E> mapped = in.stream().map(e -> doMap(e)).collect(Collectors.toList());

See java.util.Collection.stream() and java.util.stream.Collectors.toList().

Answer from leventov on Stack Overflow
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › util › Map.html
Map (Java Platform SE 8 )
July 21, 2026 - If the value for the specified key is present and non-null, attempts to compute a new mapping given the key and its current mapped value. If the function returns null, the mapping is removed.
🌐
GeeksforGeeks
geeksforgeeks.org › java › map-interface-in-java
Map Interface in Java - GeeksforGeeks
Use ConcurrentHashMap for thread-safe operations, or Collections.synchronizedMap() to make an existing map synchronized. ... import java.util.HashMap; import java.util.Map; public class Geeks{ public static void main(String[] args){ // Create a Map using HashMap Map<String, Integer> m = new HashMap<>(); // Adding key-value pairs to the map m.put("Geek1", 1); m.put("Geek2", 2); m.put("Geek3", 3); System.out.println("Map elements: " + m); } }
Published: August 31, 2026
🌐
Medium
medium.com › @AlexanderObregon › javas-stream-map-method-explained-df0d0d461d39
Java’s Stream.map() Method Explained | Medium
August 27, 2024 - The map() method is a non-terminal operation, meaning it returns a new stream rather than a final result. It takes a Function as an argument, which defines how each element in the stream will be transformed.
🌐
Java67
java67.com › 2015 › 01 › java-8-map-function-examples.html
Java 8 Stream map() function Example with Explanation | Java67
... The map is a well-known functional programming concept that is incorporated into Java 8. Map is a function defined in java.util.stream.Streams class, which is used to transform each element of the stream by applying a function to each element.
🌐
Oracle
docs.oracle.com › en › java › javase › 11 › docs › api › java.base › java › util › Map.html
Map (Java SE 11 & JDK 11 )
January 20, 2026 - If the value for the specified key is present and non-null, attempts to compute a new mapping given the key and its current mapped value. If the remapping function returns null, the mapping is removed.
🌐
GeeksforGeeks
geeksforgeeks.org › java › stream-map-java-examples
Stream map() in Java with examples - GeeksforGeeks
January 4, 2025 - <R> Stream<R> map(Function<? super T, ? extends R> mapper) where, R is the element type of the new stream. Stream is an interface and T is the type of stream elements.
Find elsewhere
🌐
CodingBat
codingbat.com › doc › java-functional-mapping.html
Java Functional Mapping
Java functional/lambda code is kind of magical, able to solve certain problem types with just 1 or 2 lines of code. In general, "mapping" is a strategy that starts with a collection of items, and runs a function on each item individually to compute a new value for that item.
🌐
DZone
dzone.com › coding › languages › java 8 map, filter, and collect examples
Java 8 Map, Filter, and Collect Examples - DZone
June 21, 2018 - Learn how to use the map() function in Java 8 to transform an object to another and how to use the filter() to select an object based upon condition.
🌐
W3Schools
w3schools.com › java › java_map.asp
Java Map
The Map interface is a part of the Java Collections Framework and is used to store key-value pairs.
🌐
W3Schools
w3schools.com › java › java_ref_hashmap.asp
Java HashMap Reference
The complete reference of Java HashMap methods, with descriptions and examples.
🌐
Oracle
docs.oracle.com › en › java › javase › 21 › docs › api › java.base › java › util › Map.html
Map (Java SE 21 & JDK 21)
January 20, 2026 - Replaces the entry for the specified key only if currently mapped to the specified value. ... Replaces each entry's value with the result of invoking the given function on that entry until all entries have been processed or the function throws an exception.
🌐
HowToDoInJava
howtodoinjava.com › home › java 8 › java stream map()
Java Stream map() with Examples - HowToDoInJava
August 26, 2023 - Java 8 Stream.map() converts Stream to Stream. For each object of type X, a new object of type Y is created and put in the new Stream.
🌐
CodingBat
codingbat.com › doc › java-map-introduction.html
Java Map Introduction
The most important Map function is map.get(key) which looks up the value for a key and returns it.
🌐
Scaler
scaler.com › home › topics › java stream map()
Java Stream map() - Scaler Topics
June 22, 2024 - The Java 8 Stream's map() method simply takes a stream of type X and returns another stream of type Y by applying the mapper function on the input stream elements and producing new stream elements of another type.
🌐
Codemia
codemia.io › home › knowledge hub › java is there a map function?
Java is there a map function? | Codemia
July 31, 2025 - One of the key aspects of Java is how it handles collections through the Java Collections Framework, which includes lists, sets, and maps. While Java does not have a built-in map function akin to those found in functional programming languages like JavaScript or Python, it does provide functionalities that allow similar operations through the Stream API, introduced in Java 8.
🌐
Tutorialspoint
tutorialspoint.com › java › java_map_interface.htm
Java - Map Interface
Following is an example to explain map functions using HashMap to add and remove elements to the map− · import java.util.HashMap; import java.util.Map; public class CollectionsDemo { public static void main(String[] args) { Map<String, String> m1 = new HashMap<>(); m1.put("Zara", "8"); m1.put("Mahnaz", "31"); m1.put("Ayan", "12"); m1.put("Daisy", "14"); System.out.println(); System.out.println(" Map Elements"); System.out.print("\t" + m1); m1.remove("Daisy"); System.out.println(" Map Elements"); System.out.print("\t" + m1); } }
🌐
Stackify
stackify.com › an-introduction-to-java-map-what-it-is-and-how-it-works
An Introduction to Java Map: What It Is and How It Works - Stackify
November 26, 2024 - Java Maps are powerful tools for all developers, using key-value pairs to simplify organizing, storing, searching, and retrieving data.
🌐
Medium
medium.com › @gauravverma.career › mastering-the-map-operation-in-java-streams-d8c819ae9e4b
Mastering the map() Operation in Java Streams | by Gaurav Verma | Medium
December 7, 2025 - The map() operation is a core component of Java's Stream API (introduced in Java 8) that transforms each element of a stream by applying a given function. Think of it as taking an input value and "mapping" it to a new, transformed output value.