# How to convert a list of strings to uppercase in Java

By Atta Ur Rehman Shah (https://attacomsian.com/about). Published Oct 29, 2022. Topics: Java.
Canonical URL: https://attacomsian.com/blog/java-convert-a-list-of-strings-to-uppercase

> Learn how to use the List.replaceAll() method to convert a list of strings to uppercase in Java.

To convert a list of strings to uppercase in Java, you can use the `List.replaceAll()` method. The `List.replaceAll()` method replaces each list element with the result of applying the operator to that element.

```java
// Declare a list
List<String> list = Arrays.asList("a", "b", "c");

// Uppercase the list
list.replaceAll(String::toUpperCase);

// Print list elements
list.forEach(System.out::println);

// A
// B
// C
```

Alternatively, you can use the Streams API `map()` method to transfer a list of strings to uppercase in Java:

```java
// Declare a list
List<String> list = Arrays.asList("a", "b", "c");

// Uppercase the list
list = list.stream().map(String::toUpperCase).collect(Collectors.toList());

// Print list elements
list.forEach(System.out::println);

// A
// B
// C
```
