Skip to content

mkyong.com

  • Spring Boot
  • Java Virtual Threads
  • Contact
  1. Home /
  2. primitive

Tag: primitive

java November 18, 2016 2 min read by mkyong 3 comments

Java – How to convert a primitive Array to List

Code snippets to convert a primitive array int[] to a List<Integer> : int[] number = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; List<Integer> list = new ArrayList<>(); for (int i : number) { list.add(i); } In Java 8, you can use the Stream APIs to do the boxing and conversion like this […]

Read more Java – How to convert a primitive Array to List

Java and Spring tutorials since 2008. Every example is a complete, runnable file, compiled and run on a real machine before it goes out.

About This Site

  • About
  • Editorial Policy
  • Contact
  • Code License
  • Privacy Policy
  • Terms of Use

© 2026 mkyong.com — Powered by WordPress

RSS