convert Long[] to long[] (primitive) java

后端 未结 5 710
感情败类
感情败类 2021-02-18 13:13

How do i convert Long[] to long[]? For example i know how to convert if it is not array as below.

long ll = (Long)Object[1].longValue()

But how

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-18 13:30

    Thanks for everyone's answer; I am just pasting my final chosen solution.

    List longObjects = new ArrayList();
    
    long[] longArray2 = ArrayUtils.toPrimitive(longObjects.toArray(new Long[longObjects.size()]));
    

提交回复
热议问题