Java Language Convert a list of integers to a list of strings


Example

List<Integer> nums = Arrays.asList(1, 2, 3);
List<String> strings = nums.stream()
    .map(Object::toString)
    .collect(Collectors.toList());

That is:

  1. Create a stream from the list
  2. Map each element using Object::toString
  3. Collect the String values into a List using Collectors.toList()