Is there a way to remove all empty cells in an ArrayList by just a built in function call? I saw trimToSize but I didn't really get what it meant.
For example, suppose I have an array that contains {1,2,3}. Lets say I say array.remove(1) so now the array looks like {1,null,3}. Is there a function to call to make it converge to be {1,3}?
I know I can hard code a method to do that for me but I was just curious.
ArrayListis not a random Java term representing an array. It's a real Java class with real methods! Start here to learn about it: download.oracle.com/javase/tutorial/collections/index.html