Answers for "map streams java"

1

map streams java

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
 
public class Main 
{
    public static void main(String[] args) 
    {
        List<String> listOfStrings = Arrays.asList("1", "2", "3", "4", "5");
         
        List<Integer> listOfIntegers = listOfStrings.stream()
                        .map(Integer::valueOf)
                        .collect(Collectors.toList());
         
        System.out.println(listOfIntegers);
    }
}
Posted by: Guest on March-02-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language