Convert int List To String List - Java java.util

Java examples for java.util:List Convert

Description

Convert int List To String List

Demo Code


//package com.java2s;
import java.util.ArrayList;

import java.util.List;

public class Main {
    public static void main(String[] argv) {
        List nums = java.util.Arrays.asList("asdf", "java2s.com");
        System.out.println(intListToStringList(nums));
    }/*from  w  w w .j a v  a  2 s .  c o m*/

    public static List<String> intListToStringList(List<Integer> nums) {
        List<String> strings = new ArrayList<>();
        for (int n : nums)
            strings.add(String.valueOf(n));
        return strings;
    }
}

Related Tutorials