Java Array, ArrayList Conversion
Convert List to Array List<String> list = new ArrayList<>();list.add(“man”);list.add(“women”);String[] arr = list.toArray(new String[list.size()]);System.out.println(Arrays.toString(arr)); Convert Array to List String[] arr = {“car”,”bike”,”van”};List<String> list = Arrays.asList(arr); // return fixed size listSystem.out.println(Arrays.toString(arr));System.out.println(list);System.out.println(list.size()); // 3System.out.println(arr.length); // 3 Replace element list.set(0, “lori”); System.out.println(Arrays.toString(arr)); System.out.println(list); Add … Continue reading Java Array, ArrayList Conversion
Copy and paste this URL into your WordPress site to embed
Copy and paste this code into your site to embed