Java 字符串List转int List - u011482647的博客 - CSDN博客

String menuIds = "1,2,3,4,5,6";

List<String> inputMenuIds = Arrays.asList(menuIds.split(","));

List<Integer> menuIdList = new ArrayList<Integer>();

CollectionUtils.collect(inputMenuIds, new Transformer() {
@Override
public Object transform(Object o) {

  **return** Integer.valueOf(o.toString());

}
}, menuIdList);

用到的包

org.apache.commons.collections.CollectionUtils;


Original url: Access
Created at: 2019-11-21 20:28:36
Category: default
Tags: none

请先后发表评论
  • 最新评论
  • 总共0条评论