[quote=引用 5 楼 hspingcc 的回复:] 能说的清楚点吗?或者有个例子.
public <T, P> P[] get(T[] as) { P[] rs = null; List<P> bs = new ArrayList<>(); for (int i = 0; i < as.length; i++) { bs.add((P)as[i]); } return bs.toArray(rs); }
能说的清楚点吗?或者有个例子.
[quote=引用 1 楼 xiesisi3 的回复:] 干嘛自己写方法 复制数组可以直接用Arrays.copyOf 或者你觉得这个不好用,你自己仿照Arrays.copyOf写一个基于底层System.arraycopy的方法
干嘛自己写方法 复制数组可以直接用Arrays.copyOf 或者你觉得这个不好用,你自己仿照Arrays.copyOf写一个基于底层System.arraycopy的方法
62,628
社区成员
307,259
社区内容
加载中
试试用AI创作助手写篇文章吧