E represents an Element, which could be any class. For example, if you're building an array list of Integers then you'd initialize it as -

You replace "Integer" with the class that the list is of.

ensureCapacity is used to ensure that the list has enough capacity to take in the new elements. It's called internally every time you add a new item to the list. As the name suggests, ArrayList uses an Array to store the items. So when the array is initialized, it's given an arbitrary length, say 10. Now once you've added 10 items, if you go to add the 11th item, it'll crash because it exceeds the arrays capacity. Hence, ensureCapacity is called (internally) to ensure that there's enough space. So if you were adding the 11th element, the array size might be, say, doubled, to 20.

And if you know you are going to add 1000 elements, you can call ensureCapacity(1000). If you don't the array size may grow in steps, to (for example) 20, 40, 80, 160, 320, 640, 1280. That's 7 resizes of the array. If you call ensureCapacity(1000) directly, it's only one resize.