{"id":310,"date":"2020-04-30T11:30:00","date_gmt":"2020-04-30T18:30:00","guid":{"rendered":"https:\/\/www.tizianasellitto.it\/blog\/?p=310"},"modified":"2020-05-11T09:47:55","modified_gmt":"2020-05-11T16:47:55","slug":"list-to-int-in-java","status":"publish","type":"post","link":"https:\/\/www.tizianasellitto.it\/blog\/?p=310","title":{"rendered":"List<Integer> to int[] in Java"},"content":{"rendered":"\n<p class=\"has-text-align-justify\">How to convert a List&lt;Integer> to a int[] in Java 8? Using Java 8 collections stream() function and then mapping to ints, we get an IntStream. With the IntStream\u00a0we can call toArray() which gives us\u00a0the int[]<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">public int[] toIntArray(List&lt;Integer> list){\n   return list.stream().mapToInt(Integer::intValue).toArray();\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>How to convert a List&lt;Integer> to a int[] in Java 8? Using Java 8 collections stream() function and then mapping to ints, we get an IntStream. With the IntStream\u00a0we can call toArray() which gives us\u00a0the int[] public int[] toIntArray(List&lt;Integer> list){ return list.stream().mapToInt(Integer::intValue).toArray(); }<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[19,14],"tags":[32],"_links":{"self":[{"href":"https:\/\/www.tizianasellitto.it\/blog\/index.php?rest_route=\/wp\/v2\/posts\/310"}],"collection":[{"href":"https:\/\/www.tizianasellitto.it\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tizianasellitto.it\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tizianasellitto.it\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tizianasellitto.it\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=310"}],"version-history":[{"count":4,"href":"https:\/\/www.tizianasellitto.it\/blog\/index.php?rest_route=\/wp\/v2\/posts\/310\/revisions"}],"predecessor-version":[{"id":334,"href":"https:\/\/www.tizianasellitto.it\/blog\/index.php?rest_route=\/wp\/v2\/posts\/310\/revisions\/334"}],"wp:attachment":[{"href":"https:\/\/www.tizianasellitto.it\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=310"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tizianasellitto.it\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=310"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tizianasellitto.it\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}