COMP 250 Lecture Notes - Lecture 4: Edge Case, Dynamic Array, Linked List
Document Summary
Typically, you can do whatever you want with arrays -- have gaps, stick anything anywhere, etc. But when you"re making a list with an array, put things in the front of the array. Last class, we talked about expanding the array when it gets bigger (when you fill it up and its full). But that was an error -- it actually increases by 50%. When you want to make a new arraylist, you must specify the type . You only interact with it when you call out shape", referring to the new array list. When you call this with no argument passed through it, it creates an array underneath of size 10 . If you know how big the array should be though, then do this: Let"s say we want an arraylist of shapes. We have an array underneath, but that"s not the whole thing.