文字列をリストに変換<整数>

 

String ids = new String("111,22,33,44");

String[] items = ids.split(",");
List<Integer> appIdList = Stream.of(items).map(Integer::parseInt).collect(Collectors.toList());

ストリームを構築し、ストリームの中間メソッドマップを使用して文字列->整数を変換し、最後にストリームの終了メソッドを使用してリストを出力します。

 

 

おすすめ

転載: blog.csdn.net/kqZhu/article/details/107691402