Convert a list of integers to a list of strings

suggest change
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()

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents