Java examples for java.util:List Convert
Convert string List To Int List
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] argv) { List strings = java.util.Arrays.asList("asdf", "java2s.com"); System.out.println(stringListToIntList(strings)); }//from ww w . ja v a2 s. co m public static List<Integer> stringListToIntList(List<String> strings) { List<Integer> nums = new ArrayList<>(strings.size()); for (String s : strings) nums.add(Integer.parseInt(s)); return nums; } }