Java 8: IntStream to Integer[]

前端 未结 1 535
渐次进展
渐次进展 2021-01-11 18:23

I am writing simple program which will eventually plot the run times of various sorting algorithms written in Java. The general interface of a sorting algorithm is via a met

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-11 18:41

    You should box the IntStream to a Stream, then call toArray to make a array of it:

    Integer[] arr = testCase(1,2,3).boxed().toArray(Integer[]::new);
    

    0 讨论(0)
提交回复
热议问题