How can I initialize the size of an ArrayList? The below code that works for initializing the size of a int array but does not work similarly for ArrayList. It prints 10 for the int array and 0 for the ArrayList. Thank you.
int[] intArray = new int[10];
ArrayList<Integer> arrlist = new ArrayList<Integer>(10);
System.out.println("int array size: " + intArray.length);
System.out.println("ArrayList size: " + arrlist.size());