且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将 int[] 数组转换为 List?

更新时间:2023-02-14 12:59:55

Arrays.asList(array) 将产生 int[] 的单例列表.

The Arrays.asList(array) will result in a singleton list of an int[].

如果将 int[] 更改为 Integer[],它会按预期工作.不知道这是否对你有帮助.

It works as you expect if you change int[] to Integer[]. Don't know if that helps you though.