List ids = invoiceApiOrders.stream().map(InvoiceApiOrder::getId).collect(Collectors.toList());
Long[] orderIds = new Long[ids.size()];
orderIds = ids.toArray(orderIds);
stream方法为JDK1.8新方法,如果版本低了那就安心走循环吧。
以上为List转数组方法,还有其他的方式可以完成目标,感觉太麻烦了,有需求可以自己找找。


![List<Long>转一维数组 Long[] List<Long>转一维数组 Long[]](http://www.mshxw.com/aiimages/31/606735.png)
