Here you can find the source of toIntList(Set
public static List<Integer> toIntList(Set<String> members)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; public class Main { public static List<Integer> toIntList(Set<String> members) { if (members == null || members.isEmpty()) { return null; }//from ww w . j av a2 s .c o m List<Integer> result = new ArrayList<Integer>(); Iterator<String> iterator = members.iterator(); while (iterator.hasNext()) { String str = iterator.next(); Integer newsId = Integer.parseInt(str); result.add(newsId); } return result; } public static List<Integer> toIntList(List<String> members) { if (members == null || members.isEmpty()) { return null; } List<Integer> result = new ArrayList<Integer>(); Iterator<String> iterator = members.iterator(); while (iterator.hasNext()) { String str = iterator.next(); if (str == null) { result.add(null); } else { int newsId = Integer.parseInt(str); result.add(newsId); } } return result; } public static boolean isEmpty(List<?> list) { if (list == null || list.isEmpty()) { return true; } else { return false; } } }