

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Department of Computer Science — University of San Francisco – p. 1/
??
container. ◦^ That means that we can use the same container to storedifferent kinds of elements.
Department of Computer Science — University of San Francisco – p. 2/
??
new^ ArrayList(3);band.add(‘‘john’’);band.add(‘‘paul’’);band.add(‘‘george’’);band.add(‘‘ringo’’);
Department of Computer Science — University of San Fra
dynamically^ beyond that. ◦^ It’s better to allocate in advance if we can. • We can also remove elements, and access them. • We can also add in the middle of a list:
band.add(1, ‘‘ringo’’);
Department of Computer Science — University of San Francisco – p. 4/
??
int[5];for (i = 0; i < 5; i++)^ { array1 = i; } int []array2= new int[10];for (i = 0; i < 5; i++)^ { array2[i] = array1[i]; } array1 = array2;
Department of Computer Science — University of San Francisco – p. 5/
??
Objects.
-^ This means that we need to cast them back to Strings. •^ Can’t store primitives.^ String^ name^ = (String)band.get(2);
Department of Computer Science — University of San Fra
Department of Computer Science — University of San Francisco – p. 7/
??
abstraction^ for us known as an iterator.
Department of Computer Science — University of San Francisco – p. 8/
??
Department of Computer Science — University of San Fra
Department of Computer Science — University of San Francisco – p. 10/
??
Department of Computer Science — University of San Francisco – p. 11/
??
Department of Computer Science — University of San Fran