Notebook revisited
Weblog-graph
Phonebook-HM
NumList
TechSupport
Do analyzeHourlyData() first!
drawData(): rectangles grow downwards!
drawData2(): fixed
This is the same StringMap class, except it is based on the standard-library HashMap. Given a key, we can look up a value.
basic idea: arrays don't literally grow.
ArrayLists keep some growth room, beyond the current size(). When an ArrayList runs out of "extra room", it allocates a new, larger array, copies the old data into this larger array, and updates its own array field to refer to this larger array.
When we need to create extra room, how much should we take? Java
ArrayList: 50% more. Drawback to creating just a single extra space.
Can we deal more constructively with out-of-range index values? How about throwing an exception?
throw outOfRangeException
or something like that.
note how size() works
version 1: all same answer
version 2: add random answers
Random
version 3: add keyword answers
HashMap
my version: tech-support-arraylist
represents sentences in InputReader as ArrayList<String> rather than HashSet<String>
Note that we can't quite keep these implementation decisions to one class!
version 4:
two-tier keyword search, then random