I want to know how & where jvm gives memory allocation to an arraylist or vector when it is expanded automatically or lets say if arraylist is having default size 16 & say after 12 it will get another 16 blocks then from where & how jvm does this?
An ArrayList is implemented with an array ... With a starting capacity of 20 or so ..
When the array is full, a new one is created with double the capacity and the old elements are copied into the new array.
And arrays directly point to a space in the memory .. this is why getting elements in an ArrayList is so fast (as opposed to LinkedList) and inserting a lot of elements takes some time, because the array has to be expanded over and over again and the elements need to be copied (as opposed to LinkedList)
JDBCSupport - An easy to use, light-weight JDBC framework -