# map()

A stream operation that transforms each element into another value.

## What does **map()** do in Java?

**map()** — A stream operation that transforms each element into another value.

```java
import java.util.List;

class NameFilter {
    List<String> shortNames(List<String> names) {
        return names.stream()
                .filter(name -> name.length() < 5)
                .map(String::toUpperCase)
                .toList();
    }
}
```

Level: Freelancer · [More Java terms at this level](https://www.ask-codey.com/glossary/subjects/java/freelancer)

Updated: September 27, 2026

## In other subjects

- [map() in JavaScript](https://www.ask-codey.com/glossary/map-javascript)

Source: https://www.ask-codey.com/glossary/map-java-2
