0
点赞
收藏
分享

微信扫一扫

字符串转list 实现List集合中数据逆序排列实现List集合中数据逆序排列

字符串转list   

/**
* 字符串转list
*/
public static List<String> strSplitToList(String str, String regex) {
List<String> list = new ArrayList<>();
if (str != null) {
if (str.contains(regex)) {
Collections.addAll(list, str.split(regex));
} else {
list.add(str);
}
}
return list;
}

实现List集合中数据逆序排列

Collections.reverse(list);     实现list集合逆序排列



举报

相关推荐

0 条评论