更新时间:2023-02-27 08:11:03
Apache的百科全书/郎有一个类ArrayUtils定义这些方法。
toObject()
由原始数组转换为包装器阵列。 toPrimitive()
从包装对象数组基本数组转换我想,你需要ArrayUtils's$c$c> toPrimitive()$c$c>
公共静态短[] toPrimitive(短[]数组)
对象短裤的数组转换为基元。
块引用>I use an ArrayList with the wrapper class Short.
After adding some values I want to get the primitive array, but it seems that there is no way with the functiontoArray(Object[] array)
, because it need an Array with the wrapper class.Is there another way without using a for or anything like that?
Apache Commons / Lang has a class ArrayUtils that defines these methods.
- All methods called
toObject()
convert from primitive array to wrapper array.- All called
toPrimitive()
convert from wrapper object array to primitive arrayI think, you need
ArrayUtils's
toPrimitive()
public static short[] toPrimitive(Short[] array)
Converts an array of object Shorts to primitives.