J Java - Data structure - List /ArrayList to array

Approch1 : 
Car[] carArr = cars.toArray(new Car[0]);


Approch 2 :
Car[] carArr2 = cars.stream()..filter(e -> e != null).toArray(c-> new Car[c]);


Remark : Array cant store null value.

留言

此網誌的熱門文章

MAP - Sort with stream

JAVA - DSF Example