Topic 6
Generic Data Structures
"Get your data structures correct first, and the rest of the program will write itself."
- David Jones
Topic 6 Generic Data Structures "Get your data structures - - PowerPoint PPT Presentation
Topic 6 Generic Data Structures "Get your data structures correct first, and the rest of the program will write itself." - David Jones Back to our Array Based List Started with a list of ints Don't want to have to write a new
CS314 Generics
2
CS314 Generics
3
CS314 Generics
4
CS314 Generics
5
CS314 Generics
6
CS314 Generics
7
CS314 Generics
8
CS314 Generics
9
CS314 Generics
10
CS314 Generics
11
CS314 Generics
12
CS314 Generics
13
CS314 Generics
14
CS314 Generics
15
CS314 Generics
16
CS314 Generics
17
public void printFirstChar(ArrayList<String> li){
ArrayList<String> list3 = new ArrayList<String>(); printFirstChar( list3 ); // ok ArrayList<Integer> list4 = new ArrayList<Integer>(); printFirstChar( list4 ); // syntax error
CS314 Generics
18